Gregg Wolin
Member
I have a series of worksheets (reports) that contain up to 48 months (rows) of data. Each sheet contains a filter column that can be toggled with a "ToggleButton1" that triggers the filter via the sub below.
I want to consolidate this code to a single Module that will apply to ANY worksheet that contains a filter column with a ToggleButton but I haven't found any examples that don't require a macro on EACH individual sheet.
Code:
Private Sub ToggleButton1_Click()
If ToggleButton1.Value = True Then
ActiveSheet.Range("$z$1:$z$60").AutoFilter Field:=1, Criteria1:="=1", _
Operator:=xlOr, Criteria2:="="
ToggleButton1.Caption = "Show ZERO Rows"
Else
ActiveSheet.Range("$z$1:$z$60").AutoFilter Field:=1
ToggleButton1.Caption = "Hide ZERO Rows"
End If
End Sub
I want to consolidate this code to a single Module that will apply to ANY worksheet that contains a filter column with a ToggleButton but I haven't found any examples that don't require a macro on EACH individual sheet.