Sub 出错在哪里如何改数组Filter()
Dim xm() As String, arr() As String, Temp '声明变量
Dim s%, r% '声明单值变量
xm = Split(Range("a1"), ",") '用A1单元格的数据创建数组
ReDim arr(1 To 1)
arr(1) = xm(0)
r = 1 '初值
s = UBound(xm) '最大下标
For i = 1 To s '循环
Temp = Filter(arr, xm(i)) '搜索数组
If UBound(Temp) = -1 Then '如果未找到
r = r + 1 '序号,自增1
ReDim Preserve arr(1 To r) '定义动态数组大小
arr(r) = xm(i) '把姓名复制到数组Arr()中。
End If
Next
Range("a2") = Join(arr, ",")
End Sub