Automatic tab colour change when cell populated

Bazz1974

New Member
Joined
Mar 30, 2021
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I having been going mad trying to find a macro to easily change the worksheet tab colors as each worksheet is populated in a set cell.
say if I entered text or date in C1, the tab colour on that worksheet turns red, otherwise is green.

I have tried so many different code and nothing will work.
There are 25 worksheets in the workbook and all numbered from 1 to 25 plus 2 others named "Lists" and "Summary" (these 2 dont need the tab colours. When you open the workbook, Id like tabs 1 to 25 to be green and once C1 has a entry, the tab for that sheet turns red. This is so the next person opening the book knows which tab has no entries as yet.

Appreciate if someone can help here.

1617104186894.png
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
If you change all the tab colours to what they should be, you can then use this
VBA Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   Select Case Sh.Name
      Case "Lists", "Summary"
      Case Else
         If Target.Address(0, 0) = "C1" Then
            Sh.Tab.Color = IIf(Target.Value = "", rgbGreen, vbRed)
         End If
   End Select
End Sub
This needs to go in the ThisWorkbook module.
 
Upvote 0
Thankyou so much. that worked a treat. I'll send it out to the gang and report back if any other issues.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

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