Protecting sheet that has macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I am protecting a sheet that has macro, my sheet fives macro error.
But when I unprotect the sheet and run the sheet, there is no error.
Please advise.
 
You could try the tools menu then protection and then the protect sheet tab,
it gives a list of things that it will allow to do on a protected sheet if
your macros preform and of those just put a tick in the box, otherwise all i
can think of is to unlock the cells that are being altered.
 
Change your macro to unprotect, run the routine then re-protect.

Sub runit()

ActiveSheet.Unprotect Password:="justme"

your code runs here

ActiveSheet.Protect Password:="justme"

End Sub


Gord Dibben MS Excel MVP
 
Hello,

If you include "ActiveSheet.Protect UserInterfaceOnly:=True" in your
code, you can keep the sheet protected while still allowing the macro
to alter the sheet.


Hope this helps,
JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Collapsing all groups 0
Macros 1
Excel Move or Copy Stopped Working? 0
unable to protect cells in macro sheet b/c runtime error 1004 1
protecting worksheets 1
Excel Protection 2
help needed 1
Unhide, Unprotect, Enter Password 2

Back
Top