troubleshooting Question

Excel VBA Select Case issue

Avatar of toalexsandr
toalexsandrFlag for United States of America asked on
ProgrammingMicrosoft ExcelSpreadsheets
4 Comments1 Solution738 ViewsLast Modified:
I am still in the beginer stage of VBA programming but a long time Excel user. I am in need of some assitance in writing a modified code. My task is to highlight rows in excel based on a keyword in a "T" column. Column "T" will have either Open, Closed, Recalled. I've tried using conditional formatting, but it wasnt working past first row. I have written a macro to do the highlighting and it works great. Here is the code...
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim oCell As Range
For Each oCell In Range("$T2:$T5000")
    Select Case oCell.Value
        Case Is = "Closed"
            oCell.EntireRow.Interior.Color = RGB(196, 215, 155)
        Case Is = "Recalled"
            oCell.EntireRow.Interior.Color = RGB(191, 191, 191)
        Case Is = "Open"
            oCell.EntireRow.Interior.ColorIndex = xlNone
    End Select
Next oCell
End Sub
But now I have a new challenge.  When I receive an document for review and its been reviewed, I record the Reviewed Date in Column "O" for that document.

Here is the problem.

Current macro just looks at Column"T" and highlights the rows.

While the document is in "Open" status, I need that row to be highlighted by a different color based on the cell not being empty in Column  "O" ( it will have a reviewed date). Afterwards, when Column "T" changes to either "Closed" or "Recalled", for that same document, the rows will be highlighted accordingly, regardless if the cell is empty or not empty in Column "O".
Join our community to see this answer!
Unlock 1 Answer and 4 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 4 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