You can unprotect a sheet, run your code then re-apply protection.
The other option is to use Protect with UserInterFaceOnlyOption Explicit Sub x() ''/// change the password here Const PW As String = "secret" On Error GoTo exit_proc Sheet1.Unprotect PW ''/// your code here exit_proc: Sheet1.Protect PW End Sub
See here for an explanation and free example workbook
http://excel-it.com/excel_userinterfaceonly.html