Protecting sheet that has macro

U

ub

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.
 
T

Terry

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.
 
G

Gord Dibben

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
 
J

JP

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
 
Top