Thanks to various posts on the board, I have the following code that will protect all sheets in my workbook:
------------------------------------------------------------------------------------
Sub ProtectAllSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect DrawingObjects:=True, AllowInsertingRows _
:=True, AllowFiltering:=True, Password:="password"
ActiveSheet.EnableSelection = xlNoRestrictions
Next ws
End Sub
-------------------------------------------------------------------------------------
I would like to use the above via add-in or personal.xls so that when I open a new workbook, I can protect all the sheets in the new workbook without copying and pasting the module into every new workbook.
When I put in personal.xls, I can run the macro but it only works on the personal.xls workbook.
When I load as an add-in, I do not 'see' the macro to reference it. I think this is the way to go, but need insights on how to work with add-ins.
Thanks...
------------------------------------------------------------------------------------
Sub ProtectAllSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect DrawingObjects:=True, AllowInsertingRows _
:=True, AllowFiltering:=True, Password:="password"
ActiveSheet.EnableSelection = xlNoRestrictions
Next ws
End Sub
-------------------------------------------------------------------------------------
I would like to use the above via add-in or personal.xls so that when I open a new workbook, I can protect all the sheets in the new workbook without copying and pasting the module into every new workbook.
When I put in personal.xls, I can run the macro but it only works on the personal.xls workbook.
When I load as an add-in, I do not 'see' the macro to reference it. I think this is the way to go, but need insights on how to work with add-ins.
Thanks...