VBA & Macro Problems

Automatically Print Personalized Forms for Multiple Names in Excel VBA

Jason MillerJason Miller Nov 12, 2026 869 views

Question details

Create a reusable Excel form that automatically prints a separate personalized copy for every name in a list.

Automatically Print Personalized Forms for Multiple Names in Excel VBA
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
The workbook contains a form sheet with a name field and a separate worksheet that stores names in a column.
Observed behavior
The goal is to place each listed name into the form's designated cell and print the form once before continuing to the next name.
Before you start

Save the workbook as an Excel Macro-Enabled Workbook (*.xlsm) and confirm that the form prints correctly for one sample name. Replace the worksheet names and cell references in the macro if your workbook uses different locations.

Solution 1Recommended

Use a VBA macro to fill and print each personalized Excel form

Use this method when names are listed on one worksheet and the same form must be printed once for every name.

This example uses a worksheet named Form, places the current name in cell B1, and reads names from column A of a worksheet named List starting at A2. The macro prints the form after each name is inserted.

1
Set up the form and name list

On the Form worksheet, choose the cell that displays the recipient name, such as B1. On the List worksheet, enter each name in column A, beginning in cell A2.

2
Save the workbook with macro support

Select File > Save As, choose Excel Macro-Enabled Workbook (*.xlsm), and save the file.

3
Open the Visual Basic Editor

Press Alt+F11 in Excel, then select Insert > Module to create a standard VBA module.

4
Paste the printing macro

Paste this code into the module: Sub PrintForms() Dim formSheet As Worksheet Dim listSheet As Worksheet Dim nameRow As Long Dim lastRow As Long Application.ScreenUpdating = False Set formSheet = Worksheets("Form") Set listSheet = Worksheets("List") lastRow = listSheet.Cells(listSheet.Rows.Count, "A").End(xlUp).Row For nameRow = 2 To lastRow formSheet.Range("B1").Value = listSheet.Cells(nameRow, "A").Value formSheet.PrintOut Next nameRow Application.ScreenUpdating = True End Sub

5
Run the macro

Return to Excel, press Alt+F8, select PrintForms, and click Run. Excel inserts each name into Form!B1 and sends one form to the selected printer.

Use a VBA macro to fill and print each personalized Excel form
Check the print destination first: The PrintOut command sends every form to the active default printer. Use File > Print to verify the printer, page range, and page setup before running the macro for a full list.

Create and Print Personalized Forms in WPS Spreadsheets

WPS Spreadsheets can help you build a reusable form, maintain a recipient list, and automate personalized printing with VBA-compatible macro tools on supported desktop editions. Its familiar spreadsheet layout makes it easy to migrate an existing Excel form workflow.

  1. 1. Open the workbook in WPS Spreadsheets: Launch WPS Office, select Spreadsheets, and open the XLSM workbook containing the Form and List worksheets.
  2. 2. Confirm the form name cell: Select the recipient cell on the Form worksheet, such as B1, and confirm that it appears correctly in File > Print preview.
  3. 3. Open the macro editor: Use the Developer or Macro tools available in your WPS desktop edition to open the VBA-compatible editor and add the PrintForms procedure.
  4. 4. Run the printing procedure: Open the Macro dialog, select PrintForms, and run it to fill the form with each name from the List worksheet and print each copy.
Create a single form template and populate the name field from a worksheet list.Use VBA-compatible macro tools on supported WPS desktop editions to automate repetitive form printing.Open and save Microsoft Excel XLSX and macro-enabled XLSM workbook formats.Use familiar spreadsheet commands for print areas, page setup, and print preview.
microsoft office alternative - wps office

Frequently Asked Questions

Where should I put the names that the macro will print?

Place the names on the List worksheet in column A, starting at A2. The provided macro finds the last nonblank cell in that column and processes each row.

How do I change the cell where the name appears on the form?

Change formSheet.Range("B1") in the VBA code to the target form cell. For example, use formSheet.Range("D5") if the name field is in D5.

Can I print more than a name on each form?

Yes. Add additional assignments inside the loop, such as formSheet.Range("B2").Value = listSheet.Cells(nameRow, "B").Value, to insert values from other list columns.

Why does Excel show a macro security warning when I open the workbook?

Macros are disabled by default for security. Open the XLSM file from a trusted location and select Enable Content only after confirming that the VBA code is safe.

How can I preview the forms instead of printing them immediately?

Replace formSheet.PrintOut with formSheet.PrintPreview in the macro. Excel will display each personalized form in print preview before it is printed.