0
下面的代碼將所有工作表內容從源工作簿複製到目標工作簿。工作表名稱完全相同。代碼將來自源的數據以完全相同的順序/範圍(「A2:A700」,「&」,「D2:D700」,「&」,「C2:C700」)複製到目標工作簿中。但是,我希望來自上述範圍內的源的數據進入目標工作簿中的不同範圍(I3,k3和AC3)。任何援助表示讚賞。將數據複製到另一個工作簿中的不同範圍內
Option Explicit
Sub seunweb()
'this macro copies from one workbook to another
Dim wbSource As Workbook, wbDestination As Workbook
Dim ws As Worksheet, rng As Range
Dim NextRow As Long, LastRow As Long
Application.ScreenUpdating = False
Set wbSource = Workbooks.Open("D:\test.xls")
Set wbDestination = ThisWorkbook
For Each ws In wbSource.Sheets
For Each rng In ws.Range("A2:A700," & _
"D2:D700," & _
"C2:C700").Areas
wbDestination.Sheets(ws.Name).Range(rng.Address).Value = rng.Value
Next rng
Next ws
wbSource.Close SaveChanges:=False
Application.ScreenUpdating = True
End Sub
它最終的工作。非常感謝。 – user1537587 2012-07-19 13:46:37