|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST6()
Dim ar, br, vResult, i&, j&, n&, r&, dic As Object
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
br = [EJ1:JE1].Value
r = Cells(Rows.Count, "EJ").End(xlUp).Row
ar = Range("EJ14:JE" & r).Value
For j = 1 To UBound(br, 2): dic(br(1, j)) = j: Next
br = [JG1:JM1].Value
ReDim vResult(1 To UBound(ar), 1 To UBound(ar, 2))
For j = 1 To UBound(br, 2)
If dic.exists(br(1, j)) Then
n = dic(br(1, j))
For i = 1 To UBound(vResult)
vResult(i, j) = ar(i, n)
Next i
End If
Next j
[JG14].Resize(UBound(vResult), UBound(vResult, 2)) = vResult
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
|