比如说,数组a的元素是
a[0]="1"
a[1]="11"
a[2]="111"数组b的元素是
b[0]="1"
b[1]="2"
b[2]="11"
b[3]="22"
b[4]="111"
b[5]="222"
-------------------------
该如何判断,数组a中的元素,是否都在数组b中存在聂?

解决方案 »

  1.   

    for i=lbound(a) to ubound(a)-1
       for j=lbound(b) to uboudn(b)-1
          if a(i)=b(j) then debug.print "有相同的"
       next
    next
      

  2.   

    chenhui530(陈辉)你还是没看懂我的题。
      

  3.   

    Private Sub Form_Load()
        arrTemp = Array(1, 11, 111)
        arrSetKoumokuCD = Array(1, 2, 11, 22, 111, 222)
        Dim bln
        
        For intJ = 0 To UBound(arrTemp)
            bln = True
            For intM = 0 To UBound(arrSetKoumokuCD)
                If Trim(arrTemp(intJ)) = Trim(arrSetKoumokuCD(intM)) Then
                    Exit For
                ElseIf intM = UBound(arrSetKoumokuCD) Then
                    bln = False
                End If
            Next
            If bln = False Then
                Exit For
            End If
        Next
        
        If bln = False Then
        Debug.Print "no"
        Else
        Debug.Print "ok"
        End If
        
    End Sub
      

  4.   

    Dim n1, n2, n, i
    n1 = Array(1, 11, 111)
    n2 = Array(1, 2, 11, 22, 111, 222)
    n = Join(n2)
    For i = 0 To UBound(n1)
    If InStr(n, n1(i)) = 0 Then Exit For
    Next
    If i > UBound(n1) Then
    MsgBox "YES"
    Else
    MsgBox "NOT"
    End If
    单循环,效率应该比双循环快