View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default How to get a macro to run that uses a protected sheet

Have then macro turn protection off and then when done turn it back on:

Sub MyMacro()

Sheets("Sheet1").Unprotect
' Run the rest of your code here
Sheets("Sheet1").Protect

End Sub
--
- K Dales


"MPM" wrote:

I would like to create some simple macros (e.g. selecting criteria within an
autofilter and then printing the result) but I would also like to protect the
sheet that contains the Autofiltered data.

When I turn protection on the macro fails.

Is there any way to run macros AND protect sheets?

Thanks