Find page break and unhide rows

Ben_goldfinch

New Member
Joined
Nov 15, 2016
Messages
11
Im after some code to unhide rows in a range until a certain named row is at the bottom of the page

i have named the bottom row "pageendrow"

and i have hidden 20 rows named the first one "evenrowstart" and the last of the 20 rows "evenrowend"

i was think some sort of loop from 1 to 20 testing for the page break each time it returns a negative result it unhides a row and was wanting those rows to be a row height of 25.5 if that makes sense or the other option would be to have just 1 row whos's row height gets increased until the pageendrow hits the pagebreak

or open to other ideas
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
probably quicker to unhide all rows, and then close up those that are not required behind an application.screenupating = false
 
Upvote 0
ive tried what you suggested, which works as a standalone subroutine, but when i call it up from another macro it only registers 1 page
this counts the number of pages in the print area, then hides a cell, then counts again and keeps going until it gets a difference


Sub demo()
'
' demo Macro
'
Dim Difference$
Dim Offsetno$
Dim Pages$
Dim Hpages$
Offsetno = 0
Difference = 0


Do Until Difference = 1


Pages = (ActiveSheet.HPageBreaks.Count + 1)
MsgBox Pages
Range("evenrowsstart").Offset(rowoffset:=Offsetno).EntireRow.Hidden = True






Hpages = (ActiveSheet.HPageBreaks.Count + 1)


Difference = Pages - Hpages
MsgBox Hpages


Offsetno = Offsetno + 1


Loop


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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