Macro to copy data to a template from a separate file and 'save as' fulfulling certain criteria

nilsan7

New Member
Joined
May 22, 2011
Messages
10
Help Please. I need a macro to open a templete, paste data from another file and then save the file - 'Save as' and name the file as per the data in two adjacent cells. Will need 2000 such files and hence a Macro is the best option. I have written & used macros in the past so am quite familiar with it:

Here is the sample format. Let us assume:

a) Template.xls has Staff Number, Name and City in the first 3 rows and next to it I have to paste the values.
b) Data.xls has the values of all staff. The column headings are Staff Number, Name and City running to 2000 rows.
c) Once the data is pasted, I want to save the excel file as the value in the2 cells in the template.xls file, Staff Number and City.

This needs to be looping until all 2000 rows data has been saved into 2000 separate files using the same template.xls as the base file.

Thanks in advance
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
'FILL OUT A TEMPLATE FROM A DATABASE
I have a macro for taking the data from a database sheet and filling out a template sheet over and over again with the data.

The macro fills out the template and saves each one as a separate file OR creates a separate sheet, your choice. That last part can be tweaked to do other things, this is mainly to demonstrate a simple way to fill out a form from a row-based database.

This should get you well along the way...
 
Upvote 0
Thanks for your reply and sorry for not comiung back to you earlier. In the end, I used one of my previous Macros and reversed the logic and got what I wanted and hence did not use your method. It worked fine so I left it at that. However, I thank you for your help. I went to your website and marked it for future reference. Take care. Cheers
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,767
Members
452,940
Latest member
rootytrip

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