VBA & Macro Problems

Excel VBA Macro to Copy Column Values and Print a Worksheet

Emma BrownEmma Brown Dec 2, 2026 870 views

Question details

Create a macro that copies each value from the Recap sheet into cell G11 on another sheet and prints that sheet.

Copy Column Values and Print a Worksheet with Excel VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
Use consecutive values in Recap column B to produce one printout of the Worksheet sheet per value.
Observed behavior
Each value is placed in Worksheet!G11 and the sheet is printed, stopping after the last populated row in Recap column B.
Before you start

Confirm that the sheets are named Recap and Worksheet, and identify the first data row in Recap column B. Set up the printer and check the Worksheet sheet's print area and layout before running the macro.

Solution 1Recommended

Loop through Recap column B and print each value

Use this VBA macro to update G11 and print the Worksheet sheet once for each row through the last populated row in column B.

The example starts at row 2 to allow for a header. Change firstRow to 1 if the data starts in row 1. The loop prints for every row in the range, including blank rows between populated cells.

1
Open the VBA editor

In desktop Excel, open the workbook and select Developer > Visual Basic. On Windows, you can also press Alt+F11.

2
Insert the macro

In the VBA editor, select Insert > Module and paste this code: Sub PrintEachRecapValue() Dim recap As Worksheet Dim target As Worksheet Dim lastRow As Long Dim firstRow As Long Dim r As Long Set recap = ThisWorkbook.Worksheets("Recap") Set target = ThisWorkbook.Worksheets("Worksheet") firstRow = 2 lastRow = recap.Cells(recap.Rows.Count, "B").End(xlUp).Row If lastRow < firstRow Then Exit Sub For r = firstRow To lastRow target.Range("G11").Value = recap.Cells(r, "B").Value target.Calculate target.PrintOut Next r End Sub

3
Save and test

Select File > Save As and save the workbook as an Excel Macro-Enabled Workbook (.xlsm). To check the output before printing, temporarily replace target.PrintOut with target.PrintPreview and run the macro with a small set of values.

4
Print the worksheets

Restore target.PrintOut, then select Developer > Macros, choose PrintEachRecapValue, and select Run. Enable macros only if you trust the workbook.

Loop through Recap column B and print each value
Check calculation dependencies: The macro recalculates the target sheet before printing. If its formulas depend on other sheets and the workbook uses manual calculation, recalculate the workbook before each print instead of relying on target.Calculate alone.
Free Microsoft Office alternative

Work with Excel-Compatible Spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move existing worksheets into WPS. It does not fix Excel VBA issues, and macro support may vary by WPS edition and platform.

Open and edit Excel-compatible XLS and XLSX spreadsheetsUse a familiar worksheet interface to review values and print layoutsMove existing spreadsheet files into WPS OfficeAccess free spreadsheet tools in a lightweight office suite
QA img-9

Frequently Asked Questions

How do I start the macro at the first row instead of row 2?

In the VBA editor, change firstRow = 2 to firstRow = 1, then save the module.

What happens if there is a blank cell in Recap column B?

The loop processes every row from firstRow through the last populated row. A blank cell within that range is copied to G11 and still produces a printout.

How can I preview the sheets instead of sending them to the printer?

Temporarily replace target.PrintOut with target.PrintPreview in the VBA module, then run the macro from Developer > Macros. Restore PrintOut when you are ready to print.

Why should I save the workbook as an XLSM file?

The XLSM format preserves VBA macros. Select File > Save As and choose Excel Macro-Enabled Workbook before closing the workbook.