Page Break Preview

GeorgeB

Board Regular
Joined
Feb 16, 2002
Messages
239
I recorded a Macro to adjust the page breaks.

Sub Macro2()
' Macro2 Macro

ActiveWindow.SelectedSheets.PrintPreview
ActiveSheet.PageSetup.PrintArea = "$A$1:$H$25"
ActiveWindow.SelectedSheets.PrintPreview
End Sub

Try to run it and it stops at the Print Preview window. Click Page Break Preview and it continues and does the adjustment then goes back to Print Preview. You have to click on Normal View to get it to finish. What do you have to do to get to run all the way through???
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I'm not sure I understand the question. What is it exactly that you want to do? There are so many print settings in Excel that it's rarely necessary to set the print area unless you *must* keep other data on the same worksheet.

Could you give more detail? Thanks!
 
Upvote 0
I have a workbook with a sheet that gets copied many times. Somhow the print area got screwed up before I noticed. I don't want to go through the effort of manually adjusting every sheet if a Macro will do it. Any solutions??
 
Upvote 0
I guess I don't understand the point of print preview at all. Just take both of those lines out of your code and just use the print area line.
 
Upvote 0
Hey thanks Dreamboat. It works great. The Macro recorder put the print preview in and I didn't realize it was not necessary. Thanks again.
George
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,938
Members
448,534
Latest member
benefuexx

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