2 Questions: (1) How do I adjust the range to start on row 8 on the "TO" sheet and start at row 5 on the "BOM Worksheet". When I've attempted to simply adjust "B" to "B8:B" or "P" to "P5:P" it skewed the matching capability.
2nd Question:
If I wanted to change it to highlight the row instead of a single cell, how do I adjust? I know there probably needs to be something added to specify Range.Row vs Range.Cell - but not sure how to incorporate that into this existing code.
(row meaning --- highlight from A until data ends at right)
Code:
Sub CompareAndHighlightGreen()
'THIS ONE LOOKS FOR CELLS THAT >>> DO <<< MATCH AND HIGHLIGHTS THEM
Dim rng1 As Range, rng2 As Range, i As Integer, j As Integer
Dim isMatch As Boolean
For i = 2 To Sheets("TO").Range("B" & Rows.Count).End(xlUp).Row
isMatch = True
Set rng1 = Sheets("TO").Range("B" & i)
For j = 1 To Sheets("BOM Worksheet").Range("P" & Rows.Count).End(xlUp).Row
Set rng2 = Sheets("BOM Worksheet").Range("P" & j)
If StrComp(Trim(rng1.Text), Trim(rng2.Text), vbTextCompare) = 0 Then
isMatch = False
Exit For
End If
Set rng2 = Nothing
Next j
If Not isMatch Then
rng1.Interior.Color = RGB(173, 255, 47)
'rng1.Value = "Incorrect Name"
End If
Set rng1 = Nothing
Next i
End Sub
2nd Question:
If I wanted to change it to highlight the row instead of a single cell, how do I adjust? I know there probably needs to be something added to specify Range.Row vs Range.Cell - but not sure how to incorporate that into this existing code.
(row meaning --- highlight from A until data ends at right)