|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
放眼TOT 发表于 2012-12-30 10:18
大神大神你好,,,看到您在线好高兴!!!,麻烦的我又来了,,,=。=
对亏了您那么复杂的数据我很快就 ...
试试- Sub test()
- Dim ar, br, i, j&, n&, dic1 As Object, dic2 As Object
- Set dic1 = CreateObject("scripting.dictionary")
- Set dic2 = CreateObject("scripting.dictionary")
- ar = Sheet1.Range("a1").CurrentRegion
- ReDim br(1 To UBound(ar), 1 To 4)
- For i = 1 To UBound(ar)
- If ar(i, 1) <> "" And ar(i, 2) <> "" Then
- dic1(ar(i, 1)) = ""
- dic2(ar(i, 2)) = ""
- End If
- Next
- For i = 1 To UBound(ar)
- If dic1.exists(ar(i, 5)) And dic2.exists(ar(i, 6)) Then
- n = n + 1
- For j = 5 To 8
- br(n, j - 4) = ar(i, j)
- Next
- End If
- Next
- Sheet2.Cells.ClearContents
- Sheet2.Range("a1").Resize(n, UBound(br, 2)) = br
- End Sub
复制代码 看,EFGH列输出到sheet2 |
|