VBA给数组配赋失败, 数组内数据为0 请高手指点
Dimarr,brr,crr,drr,errDima,b,i,j,k,lAsIntegerarr=Range("a1").CurrentRegiona=UBound(ar...
Dim arr, brr, crr, drr, err
Dim a, b, i, j, k, l As Integer
arr = Range("a1").CurrentRegion
a = UBound(arr, 2)
i = 1
j = 1
k = 1
l = 1
ReDim brr(1 To UBound(arr, 1), 1 To a)
ReDim crr(1 To UBound(arr, 1), 1 To a)
ReDim drr(1 To UBound(arr, 1), 1 To a)
ReDim err(1 To UBound(arr, 1), 1 To a)
With Sheets("汇总表")
For b = 4 To Range("A65536").End(xlUp).Row
If Range("A" & b).Text Like "*Q1" Then
brr(i, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
i = i + 1
ElseIf Range("A" & b).Text Like "*X1" Then
crr(j, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
j = j + 1
ElseIf Range("A" & b).Text Like "*X2" Then
drr(k, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
k = k + 1
Else
err(l, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
l = l + 1
End If
Next
End With 展开
Dim a, b, i, j, k, l As Integer
arr = Range("a1").CurrentRegion
a = UBound(arr, 2)
i = 1
j = 1
k = 1
l = 1
ReDim brr(1 To UBound(arr, 1), 1 To a)
ReDim crr(1 To UBound(arr, 1), 1 To a)
ReDim drr(1 To UBound(arr, 1), 1 To a)
ReDim err(1 To UBound(arr, 1), 1 To a)
With Sheets("汇总表")
For b = 4 To Range("A65536").End(xlUp).Row
If Range("A" & b).Text Like "*Q1" Then
brr(i, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
i = i + 1
ElseIf Range("A" & b).Text Like "*X1" Then
crr(j, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
j = j + 1
ElseIf Range("A" & b).Text Like "*X2" Then
drr(k, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
k = k + 1
Else
err(l, a) = Range(.Cells(b, 1), .Cells(b, a)).Value
l = l + 1
End If
Next
End With 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询