Rix,
There is nothing wrong with the code. I do not know what these colours are
If ws.Tab.ThemeColor = xlThemeColorLight2 And ws.Tab.TintAndShade = -0.249977111117893
So I have changed this line to test if the code works, it does. It has hidden if my worksheets have either red,or yellow tab. In your case each work sheet has to fulfil both conditions since you have (and), mine is Or. Whle in excel. Do Alt+F8- This will take you to Visual basic page -Go to insert and copy and paste the code
Sub HideUnhide1()
Application.ScreenUpdating = False
Dim ws As Worksheet
On Error Resume Next
For Each ws In Worksheets
If ws.Tab.ThemeColor = red Or ws.Tab.TintAndShade = yellow Then
ws.Visible = (ws.Visible = False)
End If
Next ws
Application.ScreenUpdating = True
End Sub
Bookmarks