Carlosjunior
New Member
- Joined
- Jun 7, 2023
- Messages
- 7
- Office Version
- 2021
- Platform
- Windows
Private Sub ToggleButton1_Click()
' hide or show rows 2 to 4 if button is clicked
Sheets("Sheet1").Range("2:4").EntireRow.Hidden = ToggleButton1.Value
End Sub
Private Sub UserForm_Activate()
' toggle button state based on hidden state of rows
ToggleButton1.Value = Sheets("Sheet1").Range("2:4").EntireRow.Hidden
End Sub
------------------------------------------------------------------------------------------------------------------
For the code above for me its working. What I want now is, if i click on the toggle button must change color to vbgreen and if click it again change color to vbred
' hide or show rows 2 to 4 if button is clicked
Sheets("Sheet1").Range("2:4").EntireRow.Hidden = ToggleButton1.Value
End Sub
Private Sub UserForm_Activate()
' toggle button state based on hidden state of rows
ToggleButton1.Value = Sheets("Sheet1").Range("2:4").EntireRow.Hidden
End Sub
------------------------------------------------------------------------------------------------------------------
For the code above for me its working. What I want now is, if i click on the toggle button must change color to vbgreen and if click it again change color to vbred