NEED VBA Code to eliminate page break when rows hidden

Sweetmusic1

New Member
Joined
Dec 1, 2014
Messages
6
I have a worksheet whereby rows are viewed when the check box is selected and hidden when the check box is deselected. I created a print range that will only print the visible rows, however, because I have page breaks - the print command includes the page breaks even when the rows are hidden. How do I fix this? Sub PRINTSUPPORT()
'
' PRINTSUPPORT Macro
'
'
ROWS("7:73").Select
ActiveSheet.PageSetup.PrintArea = "$7:$73"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a14")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a20")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a28")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a40")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a56")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a65")
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
Sub PRINTDEPOPS()
'
' PRINTDEPOPS Macro
'
'
ActiveWindow.SmallScroll Down:=57
ROWS("75:171").Select
ActiveSheet.PageSetup.PrintArea = "$75:$171"
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a95")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a114")
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Worksheets(1).Range("a138")
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub


 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,216,739
Messages
6,132,439
Members
449,728
Latest member
teodora bocarski

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