Fix Excel VBA Not Recording Worksheet Print Commands
Question details
The user needs a way to include worksheet printing in an Excel VBA macro when the macro recorder does not capture the print action.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Recording a macro that prints selected worksheets.
- Observed behavior
- The recorded macro may not include the print command.
Make sure a printer is available and decide whether the macro should print selected sheets or the entire workbook. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if you need to keep the VBA code.
Add a PrintOut command to the VBA macro
Use VBA to print the selected worksheets or the entire workbook when the recorder omits the print action.
In Excel, open the Developer tab and select Visual Basic. If the Developer tab is hidden, enable it in Excel's ribbon settings.
In the VBA editor, find the recorded macro in its module. Add ActiveWindow.SelectedSheets.PrintOut where you want the currently selected worksheets to print.
To print specific worksheets instead, use Sheets(Array("Sheet1", "Sheet2")).PrintOut and replace the names with your sheet names. To print the entire active workbook, use ActiveWorkbook.PrintOut.
Save the workbook as an .xlsm file. Select the intended worksheet tabs, then use Developer > Macros to select and run the macro.

Print spreadsheets with WPS Office
WPS Office is a free, lightweight alternative for opening and printing spreadsheets through a familiar interface. Its Microsoft Office format support helps you move existing files into WPS, though it does not fix Excel's macro recorder.

Frequently Asked Questions
Why is the print command missing from my recorded Excel macro?
Excel's macro recorder may not capture a print action. Open Developer > Visual Basic and add a PrintOut command to the recorded macro manually.
How do I print only the currently selected worksheets with VBA?
Select the worksheet tabs you want to print, then run a macro containing ActiveWindow.SelectedSheets.PrintOut. The command uses the selected sheets at the time the macro runs.
How can I print the whole workbook instead?
Add ActiveWorkbook.PrintOut to the macro in the VBA editor. It prints the active workbook rather than limiting the job to selected sheets.
What file format should I use to keep the macro?
In Excel, choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm). Saving as .xlsx does not retain VBA macros.




