能不能用表格控件显示?
Sub abc()Dim i As Integer, j As Integer, R As Integer
Dim d As Object
Dim ar, br(), m As Integer
Set d = CreateObject("Scripting.Dictionary")
R = Sheets(1).[K65536].End(3).Row
ar = Sheets(1).Range("K5:M" & R)
ReDim br(1 To UBound(ar), 1 To 2)
For i = 1 To UBound(ar)
If Not d.Exists(ar(i, 1)) Then
m = m + 1
d(ar(i, 1)) = m
br(m, 1) = ar(i, 1)
br(m, 2) = ar(i, 3)
Else
br(d(ar(i, 1)), 2) = br(d(ar(i, 1)), 2) + ar(i, 3)
End If
Next
Sheets(1).Range("E" & R + 2).Resize(m, 2) = br
想把数组br的输出结果在datagrid上显示?
[此贴子已经被作者于2018-4-27 09:57编辑过]