rjacmuto32
Member
have several tabs in my workbok with macros in the file. I want to protect my worksheets so users can't change them only use the functions on it. I found this code which protected all my worksheets and worked great. The sheets where protected and my macro's ran in the background without any unprotect code in all the macro's.
However that was only for Protect Worksheet. I want to Protect Workbook so people can't unhide tabs on their own or stuff like that. When I did that, the macro's didn't run anymore. Does anyone know any way to Protect Workbook and still have all the macro's run, or something to add to this code.
Private Sub Workbook_Open()
Dim Sh As Worksheet
For Each Sh In Worksheets
Sh.Protect UserInterFaceOnly:=True
Next
End Sub
However that was only for Protect Worksheet. I want to Protect Workbook so people can't unhide tabs on their own or stuff like that. When I did that, the macro's didn't run anymore. Does anyone know any way to Protect Workbook and still have all the macro's run, or something to add to this code.
Private Sub Workbook_Open()
Dim Sh As Worksheet
For Each Sh In Worksheets
Sh.Protect UserInterFaceOnly:=True
Next
End Sub