In column C, I have values of Y and N. I want to hide rows that have a Y in column C. The caption will be "Hide Received", which will be all rows that have a Y in column C. And "Show All" which will show all rows (this will include values with Y and N) I have written the following code, but cannot seem to get it to work.
Does anybody know how to write the code for this? Many thanks!
![]()
Private Sub ToggleButton1_Click() With Me If .ToggleButton1.Value = False Then If .AutoFilterMode Then .UsedRange.AutoFilter .ToggleButton1.Caption = "Hide Received" Else .UsedRange.Columns(3).AutoFilter Field:=1, Criteria1:="<>Y" .ToggleButton1.Caption = "Show All" End If End With End Sub
Bookmarks