You can unprotect a sheet, run your code then re-apply protection.

Option 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
The other option is to use Protect with UserInterFaceOnly

See here for an explanation and free example workbook

http://excel-it.com/excel_userinterfaceonly.html