billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Good Afternoon all
Looking to copy values [to another worksheet] from Column H which are not in Column T
This Script highlights column H values not in Column T - hoping for some insight how to attain the above request.
Thanks guys.
Looking to copy values [to another worksheet] from Column H which are not in Column T
This Script highlights column H values not in Column T - hoping for some insight how to attain the above request.
Thanks guys.
Code:
Sub CompareRangesII()
Dim r As Range
Dim Dict As Object
Dim Sht1 As Worksheet
Set Dict = CreateObject("scripting.dictionary")
Set Sht1 = Worksheets("Test")
With Dict
.CompareMode = vbTextCompare
For Each r In Sht1.Range("T2", Sht1.Range("T" & Rows.Count).End(xlUp))
If Not .exists(r.Value) Then .Add r.Value, r.Row
Next r
'Look through list in Column H and asertain if exists in Column T
For Each r In Sht1.Range("H1", Sht1.Range("H" & Rows.Count).End(xlUp))
If Not .exists(r.Value) Then
r.Interior.Color = RGB(184, 205, 208)
'this highlights Column H values Not in Column T list
r.Font.Bold = True
End If
Next r
End With
Set r = Nothing
End Sub