OK, let's try putting it in both the Sheet Activate, Selection, and Change events, to try to capture most possibilities.
In order for the following code to work, it absolutely MUST be placed in the "ThisWorkbook" module in VBA. If you put it in any other model, it will not work.
Also note that I assumed that your are NOT using a password in your protection (since you did not mention that earlier when I asked):
VBA Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
' Check protection status of sheet
If Sh.ProtectContents = True Then
' Change background color of cell A1 to red
Sh.Unprotect
Sh.Range("A1").Interior.Color = vbGreen
Sh.Protect
Else
' Change background color of cell A1 to red
Sh.Range("A1").Interior.Color = vbRed
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
' Check protection status of sheet
If Sh.ProtectContents = True Then
' Change background color of cell A1 to red
Sh.Unprotect
Sh.Range("A1").Interior.Color = vbGreen
Sh.Protect
Else
' Change background color of cell A1 to red
Sh.Range("A1").Interior.Color = vbRed
End If
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
' Check protection status of sheet
If Sh.ProtectContents = True Then
' Change background color of cell A1 to red
Sh.Unprotect
Sh.Range("A1").Interior.Color = vbGreen
Sh.Protect
Else
' Change background color of cell A1 to red
Sh.Range("A1").Interior.Color = vbRed
End If
End Sub