Pretty new to this coding thing but I like the possibilities it brings. I have been stuck for a few days searching the internet trying to figure out how to perform a Worksheet Change event with 3 different drop downs. I get them all to work independently but I want to combine them so that if I choose 3 different options (in my case, days of workouts, blocks of workouts, and workout types) it pulls up a specific worksheet/program. I bit off a little more than I can chew and I know there is an answer out there of how to combine the ShowSelSheets code to show the one I want but I can't seem to do it by myself. Here is my coding so far and any help is much appreciated!
Code
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("DaysofWorkouts").Address Then
Select Case Target.Value
Case " Days of Workouts"
ShowAllDays
Case ""
'do nothing
Case Else
ShowSelDays
End Select
ElseIf Target.Address = Range("Blocks").Address Then
Select Case Target.Value
Case " Training Blocks"
ShowAllBlocks
Case ""
'do nothing
Case Else
ShowSelDays
ShowSelBlocks
End Select
ElseIf Target.Address = Range("WorkoutTypes").Address Then
Select Case Target.Value
Case " Workout Types"
ShowAllSheets
Case ""
'do nothing
Case Else
ShowSelDays
ShowSelBlocks
ShowSelSheets
'do nothing
End Select
End If
End Sub
Private Sub ShowAllDays()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Visible = xlSheetVisible
Next ws
End Sub
Private Sub ShowSelDays()
Dim ws As Worksheet
Dim strType As String
strType = Worksheets("Sheet1").Range("DaysofWorkouts").Value
For Each ws In ActiveWorkbook.Sheets
If InStr(1, ws.Name, strType) > 0 Then
ws.Visible = xlSheetVisible
Else
If ws.Name <> "Sheet1" Then
ws.Visible = xlSheetHidden
End If
End If
Next ws
End Sub
Private Sub ShowAllBlocks()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Visible = xlSheetVisible
Next ws
End Sub
Private Sub ShowSelBlocks()
Dim ws As Worksheet
Dim strType As String
strType = Worksheets("Sheet1").Range("Blocks").Value
For Each ws In ActiveWorkbook.Sheets
If InStr(1, ws.Name, strType) > 0 Then
ws.Visible = xlSheetVisible
Else
If ws.Name <> "Sheet1" Then
ws.Visible = xlSheetHidden
End If
End If
Next ws
End Sub
Private Sub ShowAllSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
ws.Visible = xlSheetVisible
Next ws
End Sub
Private Sub ShowSelSheets()
Dim ws As Worksheet
Dim strType As String
strType = Worksheets("Sheet1").Range("WorkoutTypes").Value
For Each ws In ActiveWorkbook.Sheets
If InStr(1, ws.Name, strType) > 0 Then
ws.Visible = xlSheetVisible
ws.Activate
Else
If ws.Name <> "Sheet1" Then
ws.Visible = xlSheetHidden
End If
End If
Next ws
End Sub
Display More
Again, thanks and any help is awesome!