troubleshooting Question

Excel WorkSheet Tab to change the color of the tab if any cell in the "B" Column is past due, or Red

Avatar of Jim Schwetz
Jim Schwetz asked on
VBAMicrosoft Excel* conditional formattingMicrosoft Office
8 Comments1 Solution190 ViewsLast Modified:
Excel WorkSheet Tab to change the color of the tab to red if any cell in the "B" Column is past due, or Red.

I have a workbook full of tabs, but the report tab has a list of reports and the due dates on the reports. With conditional Formatting, the cell will turn red when due date is close, but Since I only visit the tab a few times a month, I want the tab to turn red when a task is coming up, so I remember to check it.

I have found this code on this site and modified it to what I thought would work:
Option Explicit

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
If (Sh.Range("B2:B9").Interior.Color = RGB(255, 0, 0)) Then Sh.Tab.Color = vbRed
End Sub
And as you can probably see, the tab turned red, but will stay red even if nothing is past due.

I need the vba to check if any of the cells in range either 1: have a conditional formatting applied to the cell, or 2: test against the date in the cell.  past due or within 5 days should turn the tab red.

So the original code was set for the whole workbook, I only want it to work with one tab called "Reports"  and only 8 cells in column B.  (B2:B9).  Each of those cells has a data list(drop down list), so I can change the date once the task is done.

I tried "Function ActiveCondition" as well.  Not sure what the correct function would be to have the event triggered after click?
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros