How to change sheet tab color based on cell value?
Normally, you can change the tab color easily and quickly in Excel, but, have you ever tried to change the tab color based on cell value in a worksheet? If you are intrested in this task, I will talk about some codes for you to color the sheet tab based on a specific cell value in Excel.
Change one sheet tab color based on cell value with VBA code
Change multiple sheet tabs based on cell value with VBA code
Change one sheet tab color based on cell value with VBA code
For example, I want the current sheet tab color will be green if the cell value in A1 is the text “TRUE”, the tab color will be red if the text in A1 is “FALSE”, and the tab color will be blue if the value in cell A1 is any other text as following screenshot shown:
1. Right click the sheet tab that you want to change its color based on the data in cell A1, and then choose View Code from the context menu.
2. In the Microsoft Visual Basic for Applications window, copy and paste the below VBA code into the Module window.
VBA code: Change one sheet tab color based on cell value:
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice
If Target.Address = "$A$1" Then
Select Case Target.Value
Case "False"
Me.Tab.Color = vbRed
Case "True"
Me.Tab.Color = vbGreen
Case Else
Me.Tab.Color = vbBlue
End Select
End If
End Sub
Note: In the above code, A1 is the cell reference which you want to color the tab based on, “True”, “False” are the text you need, you can change them to your need, and you can change the color in the code as you need.
3. Then save and close this code window, now, when you enter the text “True” in cell A1, the current tab color will become green, and when you enter the text “False” in cell A1, the tab color will become red, and if other text is entered into the cell A1, the tab color will become blue automatically.
Change multiple sheet tabs based on cell value with VBA code
If you need to change multiple sheet tabs color based on a cell value, here is also a code may help you, please do as follows:
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window, in the opened window, double click ThisWorkbook under the VBAProject section, then copy and paste the below code into the blank Module:
VBA code: Change multiple sheet tabs based on cell value:
Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'Updateby Extendoffice 20160930
Select Case Sheets("Master").Range("A1").Value
Case "KTE"
Sheets("Sheet1").Tab.Color = vbRed
Case "KTO"
Sheets("Sheet2").Tab.Color = vbGreen
Case "KTW"
Sheets("Sheet3").Tab.Color = vbBlue
End Select
End Sub
Note: In the above code, A1 and Master are the cell and worksheet which you want to color the tab based on, Sheet1, Sheet2, Sheet3 are the worksheets that you want to color the tabs. KTE, KTW, KTO are the cell values in A1 that you want to color the tabs based on, you can change the references and colors in the code as you need.
2. Then save and close this code window, now, when you enter the text KTE in cell A1 of the Master sheet, Sheet1 tab will be colored in red, when you enter KTO in cell A1,the Sheet2 will be colored in green, and when you enter KTW in cell A1, the Sheet3 will be colored in blue, see screenshot:
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
- Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
- Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
- Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
- Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
- Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
- Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
- Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
- Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
- More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!





















