| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

已结贴   问题点数：20  回复次数：5

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

[此贴子已经被作者于2018-4-27 09:57编辑过]

得分:0

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

datagrid必须有源

得分:20

i,j控制行列

MSFlexGrid1.Rows：最大行
MSFlexGrid1.Cols：最大列

MSFlexGrid1.TextMatrix(i,j)="br"
得分:0

得分:0

[此贴子已经被作者于2018-4-27 11:02编辑过]

得分:0

[此贴子已经被作者于2018-4-27 11:56编辑过]

• 6
• 1/1页
• 1