|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST7()
Dim ar, br, i&, j&, r&, dic As Object, t#, iPosCol&
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
t = Timer
Range("A8:G" & Rows.Count).ClearContents
With [A6:G6]
ar = .Resize(10 ^ 3)
r = 2
For j = 1 To UBound(ar, 2)
dic(ar(1, j)) = j
Next j
End With
br = Worksheets(2).[A1].CurrentRegion.Value
For i = 2 To UBound(br)
r = r + 1
For j = 1 To UBound(br, 2)
If dic.exists(br(1, j)) Then
iPosCol = dic(br(1, j))
ar(r, iPosCol) = br(i, j)
End If
Next j
Next i
[A6].Resize(r, UBound(ar, 2)) = ar
Set dic = Nothing
Application.ScreenUpdating = True
MsgBox "执行完毕!_用时: " & Format(Timer - t, "0.00") & " 秒", 64
End Sub
|
|