|
楼主 |
发表于 2018-9-21 10:10
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
可以了,非常感谢,我早上自己也摸索了一下
Sub jj()
Dim i%, ar(), br(), d As Object, mycount
ar = Range("a1").CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(ar)
d(ar(i, 1)) = d(ar(i, 1)) + 1
Next
mycount = d("张三")
ReDim br(1 To mycount, 1 To mycount)
For i = 2 To UBound(ar)
If ar(i, 1) = "张三" Then
m = m + 1
br(1, m) = ar(i, 2)
End If
Range("c2").Resize(mycount, 1) = Application.Transpose(br)
Next
End Sub
这样也可以
不过还是你的代码好,简单,谢谢 |
|