i want to compare the values in the array taken from a certain column with values of another column
but i am getting an error "subscript is out of range" is there a better way of doing this?
Dim start As Integer
Dim SrchRngzc As Range, cel As Range, SrchRngyx As Range, cel2 As Range
Set SrchRngzc = Range("zc16:zc500")
Set SrchRngyx = Range("yx16:yx100")
Dim x As Integer, a As Integer, b As Integer, c As Integer
Dim y As Integer
Dim n As Integer
Dim arr(1 To 85) As String
Dim num(1 To 85) As Integer
y = 1
c = 1
'highlight cells that matches
For Each cel In SrchRngyx
arr(y) = cel.Value
y = y + 1
Next cel
For Each cel2 In SrchRngzc
n = 1
For c = 1 To y
If arr(n) = cel2.Value Then ' error occurs here
cel2.Interior.ColorIndex = 4
n=n+1
Exit For
End If
Next c
Next cel2