I have two workbooks. They are both open. Book1.xls and Book2.xlsm. In each of those workbooks I have different worksheets:
Book1.xls -> A1, A2, A3
Book2.xlsm -> B1, B2, B3
I want to copy a specific cell range (B5:I29) from Book1.A1 to Book2.B2 (or any other sheets).
I seem to hit a hardwall with the understanding of the syntax and correct procedure to follow.
I tried:
' Set paths
FileToCopyFrom = "C:\Book1.xls" 'change path as required
FileToCopyTo = "C:\Book2.xlsm" 'change path as required
' Set Workbooks
Dim workbookToCopyFrom As Workbook
Set workbookToCopyFrom = Workbooks(FileToCopyFrom)
Dim workbookToCopyTo As Workbook
Set workbookToCopyTo = Workbooks(FileToCopyTo)
' Copy+paste
workbookToCopyFrom.sheet("A1")Range("B5:B29, I5:I29").Copy
Worksheets("B1").Range("A10").PasteSpecial (xlPasteValues)
But I am unable to make it happen. Can you please explain me the right procedure to set the workbooks, worksheets, cell range, copy and paste?
Thank you