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