Excel精英培训网

 找回密码
 注册
123
返回列表 发新帖
楼主: liuguansky

[习题] 【字典201201班】B组(B01—B22)第2作业上交贴[已批,见A组总结]

  [复制链接]
发表于 2012-6-13 00:11 | 显示全部楼层
用条件再来一个
Sub dd()
Dim d As New Dictionary
Dim J As Long
Dim I As Long
Dim X As Long
Dim ARR
For I = 2 To 111
For J = 2 To 6
If Cells(I, 2) = Cells(J, 5) Then
d((VBA.Month(Cells(I, 1)) & "月") & "|" & Cells(I, 2)) = d((VBA.Month(Cells(I, 1)) & "月") & "|" & Cells(I, 2)) + Cells(I, 3) * Cells(J, 6)
End If
Next
Next
ReDim ARR(d.Count - 1, 1 To 3)
For X = 0 To d.Count - 1
ARR(X, 1) = Split(d.Keys(X), "|")(0)
ARR(X, 2) = Split(d.Keys(X), "|")(1)
ARR(X, 3) = d.Items(X)
Next
Range("h2").Resize(d.Count, 3) = ARR
End Sub
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-4 05:21 , Processed in 0.189007 second(s), 6 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表