|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST6()
Dim ar, br, i&, j&, k&, dic As Object, wks As Worksheet, strFileName$
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set dic = CreateObject("Scripting.Dictionary")
Set wks = Worksheets(1)
ar = Worksheets(2).[A1].CurrentRegion.Value
For i = 2 To UBound(ar)
strFileName = ar(i, 1)
For j = 2 To UBound(ar, 2)
dic(ar(1, j)) = ar(i, j)
Next j
wks.Copy
With ActiveWorkbook
With Worksheets(1)
br = .[A1].CurrentRegion.Value
For k = 2 To UBound(br): br(k, 2) = dic(br(k, 1)): Next
.[A1].CurrentRegion.Value = br
End With
.SaveAs ThisWorkbook.Path & "\" & strFileName
.Close
End With
Next i
Set dic = Nothing: Set wks = Nothing
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Beep
End Sub
|
|