VBA Print Page Range

tycasey17

Board Regular
Joined
Sep 26, 2013
Messages
93
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I have a 75-page spreadsheet that I want to be able to print a page or a range of pages without having to specify the normal way. Is there a way to be able to have a dialog box or have a cell dictate which page(s) I need to be printed?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
VBA Code:
Sub PaagesPrint()
Dim PagesPrint As Variant
Dim FrmPage As Long
Dim ToPage As Long
    PagesPrint = InputBox("Type such as 1-2")
    
    FrmPage = Split(PagesPrint, "-")(0)
    ToPage = Split(PagesPrint, "-")(1)
    ActiveSheet.PrintOut From:=FrmPage, To:=ToPage
End Sub
 
Upvote 0
Solution
I appreciate your assistance. I also for got to preface my question. I want to run this code on one sheet while it actually prints from a different sheet, if that makes sense?
 
Upvote 0

Forum statistics

Threads
1,215,586
Messages
6,125,683
Members
449,249
Latest member
ExcelMA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top