Montag, Juli 11, 2005

How to protect/unprotect sheets in VBA...

If you have protected a single sheet in Excel to prevent from user changes, you may have to edit information on this sheet while processing the VBA script.

Just add
Activesheet.Unprotect("password") to unprotect the sheet
and
Activesheet.Protect("password") to protect the sheet again.

=> Replace "password" by the password of this sheet

Hint: protecting the VBA-project with a separate passwords makes you (somehow) sure against users who try to access your code ;-)