If you tried my last post you will find that I hadn't tested it - oops!
Anyway I amout of my meeting so you can try this.
It colours matched cells in columns A and B. The loops are to 101 but
there are various ways of extending this permanently or dynamically
Have fun
Option Explicit
Sub a()
Dim ary1(0 To 100, 0 To 1) As Variant
Dim ary2(0 To 100, 0 To 1) As Variant
Dim i As Integer
Dim wks As Worksheet
Dim rng As Range
Dim i2 As Integer
Set wks = ActiveSheet
Set rng = wks.Range("A1")
For i = 0 To 100
' PUT THE VALUES FROM COLUMN a INTO FIRST ARRAY
ary1(i, 0) = rng.Offset(i).Value
ary1(i, 1) = rng.Offset(i).Address
' PUT VALUES FROM COLUMN b INTO 2ND ARRAY
ary2(i, 0) = rng.Offset(i, 1).Value
ary2(i, 1) = rng.Offset(i, 1).Address
Next i
'Stop
For i = 0 To 100
If ary1(i, 1) = "" Then Exit For
For i2 = 0 To 100
If ary2(i2, 1) = "" Then Exit For
If ary1(i, 0) < "" And ary1(i, 0) = ary2(i2, 0) And ary1(i, 1)
< "-" And ary2(i2, 1) < "-" Then
wks.Range(ary1(i, 1)).Interior.ColorIndex = 6
wks.Range(ary2(i2, 1)).Interior.ColorIndex = 6
ary1(i, 1) = "-"
ary2(i2, 1) = "-"
Exit For
End If
Next i2
Next i
MsgBox "done"
'Stop
End Sub
--
tony h
------------------------------------------------------------------------
tony h's Profile:
http://www.excelforum.com/member.php...o&userid=21074
View this thread:
http://www.excelforum.com/showthread...hreadid=514323