Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect sheet macro problems
Hi,
I have a macro that runs to insert rows when a button is clicked in my sheet. This works fine when the sheet is unprotected but not when the sheet is protected. Is there a way to protect certain cells in my sheet but have it unprotected so my macro works? Nikki |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect sheet macro problems
Nikki
If running Excel 2002 or higher you should be able to Protect the sheet with Allow insert rows enabled under ToolsProtectionProtect sheet. If running an earlier version you will have to Unprotect in code then do the inserting then re-protect. Sub yourmacro() ActiveSheet.Unprotect Password:="justme" 'do the inserting code ActiveSheet..Protect Password:="justme" End Sub Gord Dibben MS Excel MVP On Thu, 24 May 2007 17:08:03 -0700, Nikki wrote: Hi, I have a macro that runs to insert rows when a button is clicked in my sheet. This works fine when the sheet is unprotected but not when the sheet is protected. Is there a way to protect certain cells in my sheet but have it unprotected so my macro works? Nikki |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
protect sheet macro problems
Hi Nikki,
It is not necessary to unprotect and reprotect a sheet to allow the macro to run against it, instead protect the sheet with the VBA below: ActiveSheet.Protect Password:="mypass", UserInterfaceOnly:=True From the help system: UserInterfaceOnly Optional Variant True to protect the user interface, but not macros. If this argument is omitted, protection applies both to macros and to the user interface. -- Cheers, Shane Devenshire "Nikki" wrote: Hi, I have a macro that runs to insert rows when a button is clicked in my sheet. This works fine when the sheet is unprotected but not when the sheet is protected. Is there a way to protect certain cells in my sheet but have it unprotected so my macro works? Nikki |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to protect/unprotect a sheet using a macro with password | Excel Discussion (Misc queries) | |||
Protect sheet in macro | Excel Worksheet Functions | |||
Protect Workbook Vs Protect Sheet | New Users to Excel | |||
Can I protect columns w/in a "List" using Protect Sheet? | Excel Discussion (Misc queries) | |||
Using macro to un/protect sheet | Excel Worksheet Functions |