Create Excel Worksheets from Table Rows Using VBA
Question details
Create a separate Excel form or printable output for each row in a data table.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user has a table of records and a form template that should be populated once for each record.
- Observed behavior
- Each table row should produce a populated form on its own worksheet or as a separate printable output.
Put your records in an Excel table on a sheet named Data and name the table Table1. Create a form template on a sheet named Form, and identify the cells where each table column should go.
Use VBA to create a populated worksheet for each table row
Use this method when you need a separate worksheet for every record and can run VBA macros in Excel.
This example copies the Form sheet for each row in Table1. It maps the first three table columns to cells B2, B3, and B4; change these references to match your form.
In Excel, select the data and choose Insert > Table. On the Table Design tab, set the table name to Table1. Name the data sheet Data and the template sheet Form.
Save the workbook as an Excel Macro-Enabled Workbook (.xlsm), then open Developer > Visual Basic and choose Insert > Module.
Paste this code into the module: Sub CreateRecordSheets() Dim tbl As ListObject Dim rowIndex As Long Dim sheetName As String Dim ws As Worksheet Set tbl = ThisWorkbook.Worksheets("Data").ListObjects("Table1") For rowIndex = 1 To tbl.ListRows.Count sheetName = "Record_" & Format(rowIndex, "0000") Set ws = Nothing On Error Resume Next Set ws = ThisWorkbook.Worksheets(sheetName) On Error GoTo 0 If Not ws Is Nothing Then MsgBox "Sheet already exists: " & sheetName Exit Sub End If ThisWorkbook.Worksheets("Form").Copy After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count) Set ws = ActiveSheet ws.Name = sheetName ws.Range("B2").Value = tbl.DataBodyRange.Cells(rowIndex, 1).Value ws.Range("B3").Value = tbl.DataBodyRange.Cells(rowIndex, 2).Value ws.Range("B4").Value = tbl.DataBodyRange.Cells(rowIndex, 3).Value Next rowIndex End Sub
Choose Developer > Macros, select CreateRecordSheets, and click Run. Open the new Record_0001 and subsequent sheet tabs to check the field values and form layout.
Open a generated sheet and choose File > Print to preview and print it. Repeat for the other record sheets, or select multiple generated sheet tabs before printing.

Prepare individual record forms in WPS Spreadsheet
Use WPS Spreadsheet to copy a form template, enter each record's values, and print the completed sheets. This manual approach works well for a small number of records.
- 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and check the data table and form template.
- 2. Copy the template: Right-click the form sheet tab and use the move or copy sheet option to create a copy. Rename the copied tab for the record.
- 3. Fill in the record: Copy the values from one data row into the matching cells on the copied form. Repeat the copy and entry process for each remaining record.
- 4. Preview and print: Select a completed form sheet and choose File > Print to check the layout and print it.

Frequently Asked Questions
How do I map different table columns to my form?
In the VBA module, change the column numbers in tbl.DataBodyRange.Cells(rowIndex, columnNumber) and the destination addresses in ws.Range. Add another assignment for each additional field.
Why does the macro stop when I run it again?
The macro stops when a sheet such as Record_0001 already exists. Rename or remove the previously generated sheets, then run it again from Developer > Macros.
Can I print forms without creating separate worksheets?
Yes. A macro can loop through table rows, fill the same form sheet, and call its PrintOut method for each record. Test the form with File > Print before automating printing.
What if I only need to view one record at a time?
You may not need separate sheets. Use the filter arrows in the table header to display the records you need, or use Insert > PivotTable to summarize the data.




