My file has a set of 7 buttons that unhide/hide specific columns (R:X). Initially rows R:X are hidden. Clicking the toggle button 1 will unhide columns R (unclicking hides it). You can unhide/hide any combination of these seven rows.
I am trying to make it so that if you click one of the toggle buttons, the column is unhidden AND only the rows with entries (not blank) are shown. I have created 7 separate hidden columns (J:K) that call to the original 7 columns. If a cell in the column is not blank. then J:K return "Filled" (i.e. if cell R22 has a "P" in it, then J22 returns "Filled")
I currently have the code for the toggle buttons to unhide the given column in R:X and then filter the corresponding column for "Filled." This displays only the rows in that column that have entries.
The problem I am running into is if you select more than one Toggle Button (which is usually the case). I want all the rows to be displayed that have entries in any of the unhidden columns (i.e. if R22 is blank but S22 is filled, then row 22 should be displayed, and if R23 is filled but S23 is blank, then row 23 should be displayed).
If you click more than one toggle button, the data is refreshed and the column is filtered for "Fitted", but the buttons that are already selected lose there filter.
Is there any way to make it so that all the activities that have a "Fitted" for one of the displayed columns are displayed?
Here is the code for the first 3 toggle buttons (the next 4 are the same...)
rivate Sub ToggleButton1_Click()
'This is the PQM button
If ToggleButton1.Value = True Then
Columns("R:R").EntireColumn.Hidden = False
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
Selection.AutoFilter Field:=8, Criteria1:="Filled"
Else
Columns("R:R").EntireColumn.Hidden = True
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
End If
End Sub
Private Sub ToggleButton2_Click()
'This is the QAC button
If ToggleButton2.Value = True Then
Columns("S:S").EntireColumn.Hidden = False
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
Selection.AutoFilter Field:=9, Criteria1:="Filled"
Else
Columns("S:S").EntireColumn.Hidden = True
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
End If
End Sub
Private Sub ToggleButton3_Click()
'This is the PQC button
If ToggleButton3.Value = True Then
Columns("T:T").EntireColumn.Hidden = False
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
Selection.AutoFilter Field:=10, Criteria1:="Filled"
Else
Columns("T:T").EntireColumn.Hidden = True
Selection.AutoFilter Field:=1, Criteria1:="<>"
ActiveSheet.ShowAllData
End If
End Sub
Bookmarks