Sub test()
Dim arr() As String, brr() As String
Dim crr() As String
Dim i As Long, k As Long
'随便定义了2个数据,按楼主说的,brr的所有元素在arr都存在
arr = Split("A,B,C,D,E,F,G", ",")
brr = Split("B,D,G", ",")
'用crr来存取 arr-brr的元素,crr的大小如下
ReDim crr(UBound(arr) - UBound(brr) - 1)
'开整,遍历arr,把每个brr中没有的放到crr中就好了
For i = 0 To UBound(arr)
If UBound(Filter(brr, arr(i))) <>0 Then
crr(k) = arr(i)
k = k + 1
End If
Next i
End Sub
我试过了,可以滴。方法思路就是这个啦
Sub ss_Error()Dim Arr(), i&, One
Arr = Array("A", "B", "C")
For Each One In Arr
One = "=" & One
Next One
End Sub
Sub ss()
Dim Arr(), i&, One
Arr = Array("A", "B", "C")
For i = 0 To UBound(Arr)
Arr(i) = "=" & Arr(i)
Next i
End Sub
注意 for each one 方法的结果是错误的!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)