下面的代码将所有工作表内容从源工作簿复制到目标工作簿。工作表名称完全相同。该代码以完全相同的顺序/范围(“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