• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Tab colour for Protected / Unprotected Sheets

Status
Not open for further replies.

Shazz

Member
Hi,

I found the below code on the internet that is supposed to color each tab depending on if they are protected or unprotected, but it is not working.

Can anyone suggest anything please.

Code:
Private Sub Workbook_Open()

    Dim wbk As Workbook
    Dim ws As Worksheet

    Set wbk = ThisWorkbook

    For Each ws In wbk.Worksheets
        If ws.ProtectContents = True Then
            ws.Tab.Color = vbGreen
        Else
            ws.Tab.Color = vbRed
        End If
    Next

End Sub
 
Status
Not open for further replies.
Back
Top