Need a VBA module to open 2 excel files and copy named range data from File1 to File2

PeterMac65

New Member
Joined
May 7, 2020
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi excel Gurus,
I wish to open File1.XLSX and also File2.XLST and copy ALL the named ranges from File1.SheetA and paste the value into File2.SheetA.

I think the VBA will in a separate file called MODULES.XLSM

Sounds simple and I have seen some code that I could adapt but hope there might be something floating about that will do the job :)

Regards Peter
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
A couple of questions:
1) Are you going to have all three workbooks open when you run the code (that is the easiest solution to write for)
2) Although you stated that you want the Named Ranges from File1.SheetA, is that truly the case or do you want all the Named Ranged in Workbook File1
3) Where on SheetA in File2 do you want to start the list of the Named Range values
 
Upvote 0
Hi igold,

I am going to have all three workbooks open when I run the code. :)

I propose opening Modules.xlsm
Then ask for the name of "File1"
Then Open "File2" (which is a template file)

I then wish to copy all the named Range values from two (or more) sheets and if there is a matching range name in the template, copy the values from File1 to File2.

I will then Close File1 without saving leaving the File2 file open so i can check it seems OK before saving.

Regards Peter
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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