View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default 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