Hope this will help you
Private Sub CommandButton1_Click()
ReDim j(100)
Count = 0
l = 1
While Worksheets("Sheet1").Cells(l, 2) <> ""
l = l + 1
Count = Count + 1
Wend
k = 1
ce = 1
While Worksheets("Sheet1").Cells(k, 10) <> ""
k = k + 1
ce = ce + 1
Wend
For n = 1 To ce
i = 1
nonmatch = 0
While Worksheets("Sheet1").Cells(i, 2).Value <> ""
If (Worksheets("Sheet1").Cells(n, 10).Value <> Worksheets("Sheet1").Cells(i, 2).Value) Then
nonmatch = nonmatch + 1
End If
i = i + 1
Wend
If (Count = nonmatch) Then
j(n) = Worksheets("Sheet1").Cells(n, 10)
MsgBox j(n)
End If
Next
End Sub
Bookmarks