Hi All,

I am need of using a excel file as a standard template and then use a list of .csv files to populate certain rows and columns of this standard template and save it with a different name so that I can always reuse the standard template and it does not get altered..

Can anybody get me a solution. I prefer to use a VBA so as to have minimal effort to get the csv data and populate the excel.

Please help me.

Recommended Answers

All 3 Replies

I do this manually with one of my files.
1) Back up your template!!!
2) Open the .csv file with Excel
3) Delete the columns you don't want and save the result with a temporary name as an .xls file.
4) Open the temporary .xls file, highlight the column or columns you want to copy, select "copy", open the template .xls file, highlight the columns to be replaced, and select "paste".
5) If the columns are not next to each other, you'll have to do this one column at a time.
6) Don't forget to make a backup before you start! It's easy to mess up with a manual process.

Is this way efficent and easy to learn?

Hi All,

I could do this in the following manner

Workbooks.Open Model_Template
Workbooks(Master_Template).Activate
Workbooks(Master_Template).Sheets("Master_Sheet").Select
Workbooks(Master_Template).Sheets("Master_Sheet").Copy before:=Workbooks(Model_Template).Sheets("Sheet1")
Workbooks(Model_Template).Sheets("Master_Sheet").Name = New_Name
Workbooks(Model_Template).Save
Workbooks(Model_Template).Close

Master_Template is the original template
Model_Template is the new file.

I used a while loop by which I could create 1272 new Excel Workbooks with the Master_template format but data content varying. It took some 30 minutes to create and populate the new 1272 Workbooks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.