Hi,
I'm having issues with trying to ensure that certain rows I have hidden using another toggle button which should only appear when selecting the 'here' button. These are within a main drop down commanded by another toggle button and whenever I select "show rows" that I have coded the rows that I want to remain hidden are revealed. I'm quite new to the coding elements of excel and I'm sure it's n easy fix but haven't been able to find a solution.
My current codes are below:
Private Sub ToggleButton4_Click()
Dim xAddress As String
Dim splitAddress As Variant
xAddress = "87:126" 'change this to the row numbers
splitAddress = Split(xAddress, ",")
If ToggleButton4.Value Then
For Each Var In splitAddress
Application.ActiveSheet.Rows(Var).Hidden = True
ToggleButton4.Caption = "Show Rows"
Next Var
Else
For Each Var In splitAddress
Application.ActiveSheet.Rows(Var).Hidden = False
ToggleButton4.Caption = "Hide Rows"
Next Var
End If
End Sub
Private Sub ToggleButton5_Click()
Dim xAddress As String
Dim splitAddress As Variant
xAddress = "90:94" 'change this to the row numbers
splitAddress = Split(xAddress, ",")
If ToggleButton5.Value Then
For Each Var In splitAddress
Application.ActiveSheet.Rows(Var).Hidden = True
ToggleButton5.Caption = "here"
Next Var
Else
For Each Var In splitAddress
Application.ActiveSheet.Rows(Var).Hidden = False
ToggleButton5.Caption = "here"
Next Var
End If
Bookmarks