-6

我正在寻找一个将特定范围的单元格从一个工作簿复制到新工作簿的宏。该宏将从 复制单元格A1:HC5"Workbook1"并粘贴到 的相同单元格(A1:HC5)"Workbook2"。感谢您的任何指导!

4

1 回答 1

1

这应该有效:

Sub test()
   Dim wbk As Workbook

   strFirstFile = "C:\source.xls"
   strSecondFile = "C:\destination.xls"

      Range("A1:HC35").Copy

   Set wbk = Workbooks.Open(strSecondFile)
   With wbk.Sheets("Sheet1")
      Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
      False, Transpose:=False
   End With 
End Sub
于 2012-12-21T16:52:08.640 回答