|
楼主 |
发表于 2017-7-25 15:25
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
第十四个例子
本帖最后由 autumnalRain 于 2017-7-26 08:44 编辑
- Sub test()
- Set d = CreateObject("scripting.dictionary")
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheets(1).UsedRange
- For i = 2 To UBound(arr, 1)
- d(arr(i, 4)) = d(arr(i, 4)) & "," & arr(i, 51)
- Set dic(arr(i, 4)) = Range(Cells(i, 2), Cells(i, 45))
- Next
- For j = 0 To d.Count - 1
- dic.items()(j).Copy Sheets(2).[b1048576].End(xlUp).Offset(1)
- brr = Split(Mid(d.items()(j), 2), ",")
- Sheets(2).Cells(j + 2, 1) = "招-" & j + 1
- Sheets(2).Cells(j + 2, 46).Resize(, UBound(brr) + 1) = brr
- Next
- End Sub
复制代码 |
|