|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
运行到9080行就出错。实际行数是9148行,9079不会出错,就到9080行是弹出下标越界。请老师给看一下。
Sub 名称单项分类汇总()
Dim i As Long
Dim j As Long
Dim n As Long
Dim arr
Dim arr1()
Dim d2 As New Dictionary
Dim d As New Dictionary
Dim d1 As New Dictionary
Range("z6:az65536").Clear
arr = Range("b6:o" & Range("b65536").End(xlUp).Row)
For n = 1 To UBound(arr)
d2(arr(n, 2)) = ""
Next n
Range("aa6").Resize(1, d2.Count) = d2.Keys
For j = 27 To 34
d(Cells(6, j).Value) = j - 25
Next j
For i = 1 To UBound(arr)
If d1.Exists(arr(i, 1)) = False Then
d1(arr(i, 1)) = d1.Count + 1
ReDim Preserve arr1(1 To d.Count + 1, 1 To d1.Count)
arr1(1, d1.Count) = arr(i, 1)
End If
arr1(d(arr(i, 2)), d1(arr(i, 1))) = arr1(d(arr(i, 2)), d1(arr(i, 1))) + arr(i, 13)
Next i
End Sub
|
|