Dim number_find As Integer
Dim yuansu As Variant
Dim i As Integer
Dim mydim(100) As Integer
Dim number_in_dimension As Boolean
number_in_dimension=False
number_find=50
For i=1 to 100
mydim(i)=i
Next
For Each yuansu in mydim
If yuansu=number_find Then
number_in_dimension=True
End If
Next
If number_in_dimension Then
MsgBox("數在數組中")
Else
MsgBox(“數不在數組中")
End If
End Sub