用軒大的程式修改
Sub ex1()
Dim d As Object, X%, Y%
Set d = CreateObject("Scripting.Dictionary")
Application.ScreenUpdating = False
Arr = [a1].CurrentRegion
For Each a In Range([a1], [a1].End(2))
d(a.Value) = a.Column '紀錄"Inventory(test)"各名稱的欄位值
Next
Workbooks.Open ThisWorkbook.Path & "\Inventory-12-29-16-12blank.xlsx"
Workbooks("Inventory-12-29-16-12blank.xlsx").Activate
For X = 2 To UBound(Arr)
For Y = 1 To [a1].CurrentRegion.Columns.Count
Cells(X, Y) = Arr(X, d(Cells(1, Y).Value)) '利用"Inventory-12-29-16-12blank"的名稱判斷"Inventory(test)"資料欄位值
Next Y
Next X
Workbooks("Inventory-12-29-16-12blank.xlsx").Close True
Application.ScreenUpdating = True
End Sub