Hi,
I need to look up for a range of values in all the available worksheets, and in case there is any matches, then colour the value on the original range.
I have tried the following code:
Sub Compare3()
Dim WorkRng1 As Range
Dim WorkRng2 As Range
Dim Rng1 As Range
Dim Rng2 As Range
Dim DataRange As Range
Dim ws As Worksheet
xTitleId = "Buscar coincidencias"
Set WorkRng1 = Application.InputBox("Seleccionar equipos con cambios:", xTitleId, "", Type:=8)
Set WorkRng2 = Range("B1" & LastRow)
For Each Rng1 In WorkRng1
rng1Value = Rng1.Value
For Each ws In ActiveWorkbook.Worksheets
For Each Rng2 In WorkRng2
If rng1Value = Rng2.Value Then
Rng1.Interior.Color = VBA.RGB(200, 250, 200)
Exit For
End If
Next
Next
Next
End Sub
But it does not make any changes when there are matches.... Could someone help??
Many thanks,
Have a good day
I need to look up for a range of values in all the available worksheets, and in case there is any matches, then colour the value on the original range.
I have tried the following code:
Sub Compare3()
Dim WorkRng1 As Range
Dim WorkRng2 As Range
Dim Rng1 As Range
Dim Rng2 As Range
Dim DataRange As Range
Dim ws As Worksheet
xTitleId = "Buscar coincidencias"
Set WorkRng1 = Application.InputBox("Seleccionar equipos con cambios:", xTitleId, "", Type:=8)
Set WorkRng2 = Range("B1" & LastRow)
For Each Rng1 In WorkRng1
rng1Value = Rng1.Value
For Each ws In ActiveWorkbook.Worksheets
For Each Rng2 In WorkRng2
If rng1Value = Rng2.Value Then
Rng1.Interior.Color = VBA.RGB(200, 250, 200)
Exit For
End If
Next
Next
Next
End Sub
But it does not make any changes when there are matches.... Could someone help??
Many thanks,
Have a good day