Create Multiple Workbooks with Data from Single Workbook

WaterSkiExcel

New Member
Joined
Mar 11, 2014
Messages
9
I have a TEMPLATE workbook that has 106 cells (all in the same worksheet) that need to have data input in them.

I have a separate DATA workbook with 3,000 rows of data, each row has 106 columns that correspond to the cells in the TEMPLATE workbook.

I need to create 3,000 new workbooks that are populated with the data from the DATA workbook.

Is this possible?

Thanks,

Ryan
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Here is one way to do what I interpret your post describes. This Assumes that Row 1 of the Data worksheet is a header row. Copy this code to he standard code module of the workbook with 3000 rows of data.
Code:
Sub wkBk3000()
Dim wb As Workbook, sh As Worksheet, i As Long, lr As Long
Set sh = ThisWorkbook.Sheets("DATA") 'Edit sheet name
lr = sh.Cells.Find("*", sh.Range("A1"), xlFormulas, xlPart, xlByRows, xlPrevious).Row
    For i = 2 To lr
        Set wb = Workbooks.Add
        sh.Rows(1).Copy wb.Sheets(1).Range("A1")
        sh.Rows(i).Copy wb.Sheets(1).Range("A2")
        wb.SaveAs "newDATA" & i & ".xlsx" 'Edit name and file extension
        wb.Close False
    Next
End Sub

This code creates a new workbook for each row of data in the host workbook, sheet DATA. It copies the header row of sheet Data to row one of sheet1 in the new workbook. It then copies the current row (designated by the value i) to row 2 of the new workbook. It saves the new workbook as a standard workbook, without macros, and names the workbook "newDATA" and concatenates the value of i to that name so you will know which row created that workbook. If you are not using xl2007 or later, you will need to edit the file extension. You also might want to use a different name for the new workbooks. The new workbook is then closed and the process is repeated for as many times as there are rows of data.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,638
Members
449,093
Latest member
Ahmad123098

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