Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88111

Highlight cell from another cells value (dyanmic range)

$
0
0

After digging through very similar posts I just can't find a solution to my unique request. I have been able to build a formula up to this point using those threads but I am just getting confused with having two IF statements.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Address = "$U$14" Then
    Dim rng As Range, cell As Range, LastRow As Long

    With Sheets("Sheet4")
        LastRow = .Range("B"& .Rows.Count).End(xlUp).Row
    End With

    Set rng = Range("A2:A"& LastRow)

    'If O2:O200 is BLANK then highlight corresponding row (xlUp) in Column A yellow
    For Each cell In rng
        cell.Interior.ColorIndex = 27
    Next
Else
    cell.Interior.ColorIndex = 2
End If

End Sub

What I want to do is for every cell starting with O2 through O & LastRow IF it is blank then highlight corresponding row (xlUp) in column A.

(xlUp) - Because I want it to highlight the person's name and not just the row, meaning that person has not yet collected an Item.

Then when clicked off of cell U14 set it back to normal.

Sorry it is so sloppy, I tried to put as much in it as I could figure out on my own.

EXAMPLE:EXAMPLE


Viewing all articles
Browse latest Browse all 88111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>