Copy specific cells from one open file to another open file

Nick70

Active Member
Joined
Aug 20, 2013
Messages
304
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have two files open one called Data.xls and one called Summary.xls.

I have a third file open called Macro.xlsm

So all 3 files already open.

Files location is H:\Personal\

I would like to have a macro in file Macro.xlsm that copies range G10:G20 from file Data,xls sheet1 and copies it onto file Summary.xls in sheet 1 in same range G10:G20.

The macro will then save and close both Data.xls and Summary.xls.

How do I do that?

Thanks,
Nix
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
How about:

VBA Code:
Sub CopySaveClose()
'
    Workbooks("Data.xls").Worksheets("Sheet1").Range("G10:G20").Copy Workbooks("Summary.xls").Worksheets("Sheet1").Range("G10")
'
    Workbooks("Data.xls").Close SaveChanges:=True
    Workbooks("Summary.xls").Close SaveChanges:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top