Protection and Macros

  • Thread starter Thread starter Snow
  • Start date Start date
S

Snow

I am protecting a sheet with the the exception of a few
input cells BUT I have macros as well and do not want it
locked. How do I NOT protect the macros?
 
Hi Snow

Protect your worksheets with code with userfaceonly like this
Place this in the Thisworkbook module.

The macro's will be working now
It will only protect the userfaceonly

Right click on the Excel icon next to File in the menubar
And choose View code

You are now in the Thisworkbook module
Paste the Event in this place
Alt-Q to go back to Excel

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect "ABCD", , , userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub
 
Back
Top