Exclude hidden rows when printing

PuntingJawa

Board Regular
Joined
Feb 25, 2021
Messages
162
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have a workbook that consolidates serial numbers for identification tags that get placed on crates.
Excel Formula:
Sub MyHideRows()

    Dim r As Long

    Application.ScreenUpdating = False

'   Check rows 2:681
    For r = 2 To 681
        Rows(r).EntireRow.Hidden = (Cells(r, "B") = "")
    Next r
    
    
    Application.ScreenUpdating = True

End Sub

I use this in a button to hide rows in the range of 2-681 based on weather or not information is in column B (Helper cell that places a 1 if there is greater than 1 in column G which is the QTY of that item).
I have set page breaks every 40 rows which separates based on crate.

My question is, is there a way to automatically exclude any of the hidden rows when printing? I know I can do it manually by highlighting what I want to print, but I am trying to keep this simplistic for less savvy users in case I take a day off.
 
How many pages does it end up printing, exactly?
Is there any kind of "pattern", i.e. sheet of data, followed by blank sheet, followed by sheet of data, followed by blank sheet, etc.?
Is column G always populated with data, or are there a lot of blanks in column G?
17 pages (could be more if there is a lot a data in column G that causes the row height to expand, but page breaks are in the correct location.
No pattern to speak of. The blank pages are indeed areas that have no data in them and are hidden.
There is always a number (if 0 =if formula in other rows are to to return "") which is how the helper in B knows to return "" or 1.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
17 pages (could be more if there is a lot a data in column G that causes the row height to expand, but page breaks are in the correct location.
No pattern to speak of. The blank pages are indeed areas that have no data in them and are hidden.
There is always a number (if 0 =if formula in other rows are to to return "") which is how the helper in B knows to return "" or 1.
OK, I tried something and it's really odd, but worked. I inserted an extra column to the left of my data. I then reset the print area to also include it. After which, I deleted that column. Now blanks have disappeared.
 
Upvote 0
OK, that is weird, but I glad you got it figured out and working the way you need.
 
Upvote 0
OK, that is weird, but I glad you got it figured out and working the way you need.
I just double checked everything again. It reset my page breaks. So when I placed them back in, the empty sheets came back. I'm uncertain as to what is going on since I don't have this issue on another sheet with an identical setup.
 
Upvote 0
Maybe the page breaks you are setting are outside of the paper size / margins you have set
 
Upvote 0
Maybe the page breaks you are setting are outside of the paper size / margins you have set
I did a few adjustments. It's set to fit columns to 1 page.
This is what is should look like separated. Which should be 3 pages.
1722525542734.png




This is what the print preview looks like.
1722525596992.png


Even though I have the rows hidden, they still show in the print preview. I'm trying to wrap my head around what's different between this sheet and my others that work fine. I have them identical format wise.
 
Upvote 0

Forum statistics

Threads
1,224,884
Messages
6,181,558
Members
453,053
Latest member
Kiranm13

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