Hi All,

I'm using the following code for toggle buttons to hide rows. The first button seems to work fine I can hide and unhide easily. But when I try to add another button it won't let me hide or unhide unless I use the ToggleButton1 first.

The second button seems to be dependent on the first. Is there anyway to make these buttons independent because I will need up to 6 buttons.

5 of them will be for specific parts of the worksheet to hide/unhide and the last one will be to unhide all.

Thank you very much in advance.



Private Sub ToggleButton1_Click()
Dim xAddress As String
xAddress = "6:28"
If ToggleButton1.Value Then
    Application.ActiveSheet.Rows(xAddress).Hidden = True
Else
    Application.ActiveSheet.Rows(xAddress).Hidden = False
End If
End Sub

Private Sub ToggleButton2_Click()
Dim xAddress As String
xAddress = "31:46"
If ToggleButton1.Value Then
    Application.ActiveSheet.Rows(xAddress).Hidden = True
Else
    Application.ActiveSheet.Rows(xAddress).Hidden = False
End If
End Sub