Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get a macro to run that uses a protected sheet
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get a macro to run that uses a protected sheet
In code you need to unprotect then execute your code and then reprotect.
There is no way around it... -- HTH... Jim Thomlinson "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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get a macro to run that uses a protected sheet
Activesheet.Protect UserInterfaceOnly:=True
ActiveSheet.EnableAutofilter = True the autofilter must already exists, but you can change the criteria. In xl2002 and later, I believe you have to supply the password (if there is one) when you do the Protect command. -- Regards, Tom Ogilvy "MPM" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro & Protected sheet | Excel Discussion (Misc queries) | |||
use macro button to run macro in protected sheet | Excel Discussion (Misc queries) | |||
use macro on a protected sheet | Excel Programming | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming | |||
Using a Macro with the sheet protected. | Excel Programming |