I am trying to figure out how to change the fill color on each row of data that contains has a matching value from another spreadsheet. My code works but it is filling the entire row across all of the columns on the spreadsheet, I would like to only fill the columns that have data in them...in this case A:D. I'm using a For Each loop and I'm not sure how to specifiy the column range. Thanks!
Here is my current code.
Dim lRow1, lRow2, X As Integer
lRow2 = Sheets("By Resource - All Data").Range("B" & Rows.Count).End(xlUp).Row
Sheets("Priorities").Activate
lRow1 = Range("B" & Rows.Count).End(xlUp).Row
X = 1
For Each cell In Range("B3:B" & lRow1)
Do
X = X + 1
If cell.Value = Sheets("By Resource - All Data").Cells(X, "B") Then
Rows(cell.Row).Interior.ColorIndex = 2
End If
Loop Until X = lRow2
X = 1
Next cell
Here is my current code.
Dim lRow1, lRow2, X As Integer
lRow2 = Sheets("By Resource - All Data").Range("B" & Rows.Count).End(xlUp).Row
Sheets("Priorities").Activate
lRow1 = Range("B" & Rows.Count).End(xlUp).Row
X = 1
For Each cell In Range("B3:B" & lRow1)
Do
X = X + 1
If cell.Value = Sheets("By Resource - All Data").Cells(X, "B") Then
Rows(cell.Row).Interior.ColorIndex = 2
End If
Loop Until X = lRow2
X = 1
Next cell