If cell A1 in any sheet except "Test_Template" in the workbook = "FAIL" then the sheets tab turns red VBA

Tom98

New Member
Joined
Oct 26, 2020
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a workbook with multiple sheets in it. I want to be able to include the function that if Cell A1 in any sheet EXCEPT sheet "Test_Template" equals "FAIL" then that sheet tab colour changes to red. Any help with how to go about adding this in would be great.

TIA
 
If you want to use a Button:
Put this script in your button:
VBA Code:
Sub Check_A1_Range_For_Fail()
'Modified  10/28/2020  7:46:20 AM  EDT
Application.ScreenUpdating = False
Dim i As Long


For i = 1 To Sheets.Count
   
    If Sheets(i).Name <> "Test_Template" Then
        Select Case Sheets(i).Range("A1").Value
            Case "FAIL": Sheets(i).Tab.Color = vbRed
            Case Else: Sheets(i).Tab.ColorIndex = xlColorIndexNone
        End Select
    End If
Next

Application.ScreenUpdating = True
End Sub
Great! Thanks
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,215,024
Messages
6,122,729
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top