Dim b As Integer
b = InputBox("输入要查找的数")
For i = 0 To UBound(A)
If A(i)=b Then
Msgbox "找到数" & b & "了,在数组索引第" & i & "的位置"
End If
Next i
这样就可以了,你可以把这个代码写个函数来获取返回值。
vb里面有instr啊
vb里面有3个函数,instr,instrb,instrrev
_________________________________________
看错题目了~
VB里面只有filter函数,也是判断数组里面某项是否含有某字符串的
ReDim ArrI(50)
Dim Arrb
For i = 0 To 49
ArrI(i) = "165234" & i
Next
Arrb = Filter(ArrI, "12", True, vbTextCompare)
For i = 0 To UBound(Arrb)
Print Arrb(i)
Next
用Scripting.Dictionary对象吧
Private Sub Command1_Click()
Dim Dic As New Scripting.Dictionary
Dic.Add "XX", 0
Dic.Add "YY", 0
Dic.Add "ZZ", 0
If Dic.Exists("ZZ") Then Print "Find ZZ !"
Set Dic = Nothing
End Sub
除非你不用数组,用集合