Macros on Protected worksheet

J

Jim Thomlinson

2 ways.

1 - Change the protection to allow macros to modify the sheet. This requires
the addition of a parameter to the protection

Sheets("Sheet1").Protect UserInterfaceOnly:=true

2 - Unprotect the sheet. Run your code. Reprotect the sheet

Sheets("Sheet1").UnProtect Password:="Whatever"
'Your code here
Sheets("Sheet1").Protect Password:="Whatever"
 
R

Ronnie

Thanks! I'll give it a try.
--
Ronnie


Jim Thomlinson said:
2 ways.

1 - Change the protection to allow macros to modify the sheet. This requires
the addition of a parameter to the protection

Sheets("Sheet1").Protect UserInterfaceOnly:=true

2 - Unprotect the sheet. Run your code. Reprotect the sheet

Sheets("Sheet1").UnProtect Password:="Whatever"
'Your code here
Sheets("Sheet1").Protect Password:="Whatever"
 
Top