Sheet color based on cells value

draqdragos

New Member
Joined
Dec 25, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi!

So, i have this huge worksheet of 101 sheets. First "DATA" is jus that, a data sheet from which all the other 100 sheets are taking up data with lookup function.
I need the 100 sheets to change colour based on cell value from each sheet. Cell is question is "F14" on each sheet, or column on data sheet.
All I need is for the sheets where value in said cell is less then 50 to turn red.

Appreciate any help you can give be.

Thank you, have a Merry Christmas and Happy Holidays!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Welcome to the MrExcel Message Board!

If you mean changing the sheet tab color, then it can be done for all worksheets, except DATA, by using the following VBA code. To use the code, goto VBE, insert a new standard Module, copy and paste the code into this new module, and finally Run the code.
Note: The code will also change the hidden worksheets' tab color if there is any meeting the criteria. If this is not desired, then an additional condition can be added to the first If...End If block.

VBA Code:
Sub changeSheetTabColors()
Dim sht As Worksheet
    ' Loop through all worksheets in this workbook
    For Each sht In ThisWorkbook.Worksheets
        With sht
            ' Do not change the DATA worksheet tab color
            If sht.Name <> "DATA" Then
                If IsNumeric(.Range("F14")) And .Range("F14") < 50 Then
                    ' If F14 is a numeric value and less than 50, then set the color as red
                    .Tab.Color = vbRed ' Or for various colors: RGB(255, 0, 0)
                Else
                    ' Otherwise set the color as default
                    .Tab.ColorIndex = xlColorIndexNone
                End If
            End If
        End With
    Next sht
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,808
Messages
6,121,684
Members
449,048
Latest member
81jamesacct

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