I have this VBA code:
Sub OpenCopyPaste()
Dim wb As Workbook
Dim Reportwb As Workbook
' set report workbook to workbook object (works only is the file is already open)
Set Reportwb = Workbooks("report.xlsx")
' open the source workbook and select the source sheet
Set wb = Workbooks.Open(Filename:="C:\Users\Adryan Permana\Downloads\Test\part8.xlsx")
' copy the source range and paste in 1 line , paste at "C3:E9"
wb.Sheets("Sheet1").Range("C3:E9").Copy
Reportwb.Sheets("Sheet1").Range("C3:E9").PasteSpecial xlPasteValues
Reportwb.Save
End Sub
I want to copy data from "part8.xlsx" without open that file. How can I do that? Many thanks for the help.