The below code has worked on this machine previously. I worked from home yesterday on a machine which hasn't had the December 2014 Office updates removed.
Private Sub DurationCombo_Change() 'Active if duration combo box value is changed
ActiveWorkbook.Worksheets("SUMMARY").Unprotect
ActiveWorkbook.Worksheets("RATES").Unprotect
ActiveWorkbook.Worksheets("MAIN SCOPE").Unprotect
'Dim sheetsCount As Integer
'Dim i As Integer
' 'Add number of sheets to integer
' sheetsCount = ActiveWorkbook.Worksheets.Count
' For i = 1 To sheetsCount - 2
' ActiveWorkbook.Worksheets(i).Unprotect 'Unprotect first three sheets
' Application.ScreenUpdating = False 'To prevent flickering of worksheets in for loop
' Next i
'Select case here: omitted.
For i = 1 To sheetsCount - 2
ActiveWorkbook.Worksheets(i).Protect 'Protect first three sheets
Next i
Application.ScreenUpdating = True 'Restore initial setting
End Sub
I cannot run this code. It craps out on the line:
ActiveWorkbook.Worksheets("MAIN SCOPE").Unprotect
I get the same error when running the little for loop which you can see commented out. Any suggestions? The sheet exists. Unhidden. Not password-protected.
Thank you!
Aucun commentaire:
Enregistrer un commentaire