|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub TEST()
Dim ar, br, cr, i&, j&, r&, k&
Dim wks As Worksheet, dic As Object, vKey, strJoin$
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
With [A1].CurrentRegion
.Offset(1).Clear
ar = .Resize(10 ^ 3)
r = 1
End With
For Each wks In Sheets
If wks.Name <> "结果" Then
With wks
br = .[A1].CurrentRegion
For j = 1 To UBound(br, 2)
If InStr(br(1, j), "数据") Then
cr = Array(j, UBound(br, 2) - 1, UBound(br, 2))
For i = 2 To UBound(br)
If br(i, cr(0)) <> "" Then
strJoin = ""
For k = 0 To UBound(cr)
strJoin = strJoin & "," & br(i, cr(k))
Next k
If Not dic.exists(strJoin) Then
r = r + 1
For k = 0 To UBound(cr)
ar(r, k + 1) = br(i, cr(k))
Next k
dic(strJoin) = ""
End If
End If
Next i
End If
Next j
End With
End If
Next
[A1].Resize(r, 3) = ar
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
2
查看全部评分
-
|