If worksheet protected then unprotect else run rest to code?

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,778
Is there code to say:

If worksheet protected, unprotect, else move on with code,

but if it is protected to unprotect that sheet run the code and then reprotect it before looping through the other sheets when building a table of contents?

I have several worksheets that are protected and I use a table of contents maker that loops through the sheet and pluts a return to Main Menu in A1.

I merge cells A1 throught E1 to give a bigger area to click for the Main Menu words.

I have unlock the cells in rows 1 and 2, but the sheets that are protected keep causing me problems..
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Watch MrExcel Video

Forum statistics

Threads
1,114,675
Messages
5,549,363
Members
410,911
Latest member
AniEx
Top