Why this 1004 Error message?

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

A simple routine which starts as:

With ActiveWorkbook.Worksheets("Master CVI")
.Unprotect Password:="SGB"
.Cells.Locked = False

(code now works with just this sheet, and finally
protects it, before closing the With statement)

'Protect the sheet
.Protect Password:="SGB"
.EnableSelection = xlUnlockedCells
End With

I now immediately say:

'Protect the workboook
ActiveWorkbook.Protect Password:="SGB"

End Sub

and it's on this last line that the error is raised.

Why so, please?

Regards.
 
I could get a 1004 error message if the workbook were already protected with a
different password.
 
Back
Top