billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
hello all
I have this script which functions as expected, what I'd like accomplish prior to replacing the applicable values is highlight the values. unsure maybe stop at this point or continue to the replacement.
Thanks as always
I have this script which functions as expected, what I'd like accomplish prior to replacing the applicable values is highlight the values. unsure maybe stop at this point or continue to the replacement.
Thanks as always
Code:
Sub HighlightValues()
Dim c As Range
Dim k As Variant
Dim Ws1 As Worksheet, Ws2 As Worksheet
Set Ws1 = Sheets("Sheet1")
Set Ws2 = Sheets("Sheet2")
With CreateObject("scripting.dictionary")
For Each c In Ws2.Range("A2", Ws2.Range("A" & Rows.Count).End(xlUp))
.Item(c.Value) = c.Offset(, 1).Value
Next c
For Each k In .Keys
[COLOR=#ff0000] 'Highlight items at this point[/COLOR]
Ws1.UsedRange.Replace k, .Item(k), xlWhole, , True, , False, False
Next k
End With
End Sub