I have did a simple VBA to try to achieve my program, however, it seem there is some problem. Can you help me to debug my code?

CustomerDynamicArray is created in the workbook using =OFFSET(Sheet2!$A$2,0,0,COUNTA(Sheet2!$A:$A)-1,1)

[VBA]Private Sub CommandButton1_Click()

Dim x As Boolean
Dim y As Integer
Dim i As Long

x = True

y = 2


For i = LBound(Array("CustomerDynamicArray")) To UBound(Array("CustomerDynamicArray"))
If CustomerDynamicArray(i) <> y Then
x = False
Exit For
End If
Next i
If x = True Then
MsgBox "Match"
Else
MsgBox "Item " & i & " does not match"
End If

End Sub
[/VBA]