Choose a Printer Before Printing Excel Cells with VBA
Question details
The user wants an Excel VBA macro to let them choose a printer before printing a cell range.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A macro prints cells B1:J67, but the user wants to select the printer first.
- Observed behavior
- The existing PrintOut command prints without first asking the user to choose a printer.
Open the workbook in a version of Excel that supports VBA and make sure the desired printer is available to Excel. Identify the worksheet and range you want the macro to print.
Show Printer Setup Before Printing the Excel Range
Use Excel's printer setup dialog to choose the active printer, then print the specified cells.
The dialog returns False if the user cancels. The example exits in that case so the macro does not print unexpectedly.
In Excel, open the Developer tab and select Visual Basic. In the editor, open the module containing your macro or choose Insert > Module.
Replace or update your macro with this code: Sub PrintSomeCells() Dim bChoice As Boolean bChoice = Application.Dialogs(xlDialogPrinterSetup).Show(ActivePrinter) If Not bChoice Then Exit Sub Application.Calculate ActiveSheet.Range("B1:J67").PrintOut End Sub
Activate the worksheet to print, then run PrintSomeCells from Developer > Macros. Choose a printer in the setup dialog and confirm; the macro calculates and prints B1:J67 on that printer.

Print Spreadsheet Ranges with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with and printing spreadsheets. Its Microsoft Office format compatibility helps you move existing files to WPS, although it does not fix Excel's VBA behavior.

Frequently Asked Questions
What happens if I cancel the printer setup dialog?
In the example, Show returns False and the If Not bChoice Then Exit Sub line stops the macro before PrintOut.
How do I print a different range?
In the VBA editor, change ActiveSheet.Range("B1:J67") to the range you need, such as ActiveSheet.Range("A1:D20").
Does the macro print from a specific worksheet?
The example uses ActiveSheet, so it prints from the worksheet active when the macro runs. Replace ActiveSheet with a worksheet reference such as Worksheets("Sheet1") to target a named sheet.
Why does the macro calculate before printing?
Application.Calculate recalculates open workbooks before PrintOut. You can remove that line if recalculation is not needed.




