montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Hi.
Working on:
and also try:
So right here just for one time, work good, my week point is how to repeat this.
I have an array B2:F38 to be compare against H2:AJ
Range by range.
On A1 notation looks like this.
If any cell on B2:F2 match H2:H37 then highlight the duplicates
If any cell on B3:F3 match H3:H37 then highlight the duplicates
If any cell on B4:F4 match H4:H37 then highlight the duplicates
If any cell on B5:F5 match H5:H37 then highlight the duplicates
Thank you for reading my post, I hope to hear from you
"-comments on the code are highly appreciated-"
Working on:
VBA Code:
Sub on_N()
Dim rng As Range, fnd As Range
For Each rng In Range("B2:F2") ' READ
Set fnd = Range("R2:R37").Find(rng, LookIn:=xlValues, lookat:=xlWhole) '||||||||||HIGHLIGH
If Not fnd Is Nothing Then
fnd.Interior.ColorIndex = 7
End If
Next rng
End Sub
and also try:
VBA Code:
Sub CompareTwoRanges()
Set B = Range("B2:F2") ' READ
Set M = Range("R2:R37") ' WRITE
For Each c1 In M 'write k2
For Each c2 In B 'read b2
If c1.Value = c2.Value Then
c1.Interior.ColorIndex = 38
End If
Next
Next
End Sub
So right here just for one time, work good, my week point is how to repeat this.
I have an array B2:F38 to be compare against H2:AJ
Range by range.
On A1 notation looks like this.
If any cell on B2:F2 match H2:H37 then highlight the duplicates
If any cell on B3:F3 match H3:H37 then highlight the duplicates
If any cell on B4:F4 match H4:H37 then highlight the duplicates
If any cell on B5:F5 match H5:H37 then highlight the duplicates
Thank you for reading my post, I hope to hear from you
"-comments on the code are highly appreciated-"