The_Steward
Board Regular
- Joined
- Nov 26, 2020
- Messages
- 63
- Office Version
- 365
- Platform
- Windows
I am running this Macro to hide/unhide rows when form control button is clicked.
However when I protect the sheet it does not work. How can I fix this Macro so it runs when sheet is protected?
I had thought of using something like below but unsure how to configure correctly or if this would work.
VBA Code:
Sub Important_Info_TOGGLE()
Rows("24:42").EntireRow.Hidden = Not Rows("24:42").EntireRow.Hidden
End Sub
However when I protect the sheet it does not work. How can I fix this Macro so it runs when sheet is protected?
I had thought of using something like below but unsure how to configure correctly or if this would work.
VBA Code:
If Intersect(Target, OLEObject("CommandButton4")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:=""
With Sheets("Sheet19")
Rows("24:42").EntireRow.Hidden = Not Rows("24:42").EntireRow.Hidden
End With
ActiveSheet.Protect Password:=""