Print selection code doesn

szakharov7723

Board Regular
Joined
Jun 22, 2018
Messages
85
Office Version
  1. 2019
Platform
  1. Windows
Hello, I am trying to create a code to automatically select the range (that can vary horizontally) and print it.
I tried to use this code, but it prints only 1 page regardless the amount of pages needed to print all data in range.
And I don't even understand why it limits it to 1 page.

Code:
Sub PrintSelection()
'
    Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.PrintOut
End Sub
 
Re: Print selection code doesn't work properly

no tbh I see no other special info about this case. Hopefully it has something to do with the printer settings.
 
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Re: Print selection code doesn't work properly

or gives the outcome of what will happen if you execute this code

Except it doesn't :biggrin: besides obviously I would already know what outcome it gives me before I posted it.

Anyway I already stated I can't go any further without more info or a copy of the workbook to look at.
 
Last edited:
Upvote 0
Re: Print selection code doesn't work properly

Try selecting the area you want to print, then run the code from post #3 .
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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