Protecting a worksheet
You will have to add code to each button but you can make the code very short
by addin two procedures to do the protection and unprotection. Call the
unprotectall macro at the start and the protectall at the end of each command
button procedure...
sub UnProtectAll
dim wks as worksheet
for each wks in thisworkbook.worksheets
wks.unprotect Password:="Tada"
next wks
End sub
sub ProtectAll
dim wks as worksheet
for each wks in thisworkbook.worksheets
wks.protect Password:="Tada"
next wks
End sub
--
HTH...
Jim Thomlinson
"Anthony" wrote:
Hi all
I have a worksheet that contains aprox 8 buttons that each run a macro to
complete certain tasks from displaying userforms to moving to another
worksheet.
Rather than adding code into each macro, is there a way to protect the
worksheet, unprotect whilst any macro is run then protect it again once the
macro is complete?
thanks
|