Dynamic Header with multiple possibilities

ardykav

Board Regular
Joined
Oct 18, 2015
Messages
172
Office Version
  1. 365
Platform
  1. Windows
I have a file which can have anywhere between 5 and 500 rows to print. On the top of each page there should be a header but depending on the data below it the header will change thus I cant use the generic header function. I have some coding in that will hide rows if they have no data in them which means that the print ranges change a lot. My question is, is there some coding that I can use to place one of the 3 header options at the top of each page depending on where the page breaks are? To add an extra layer of complexity the sheet is entirely made up of formulas so putting in a formula for the header will erase formulas that are there and could cause issues for the next time any code is ran.

thanks in advance
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Suspect you need a For Next loop that parses the Nth row for each page, so really, it becomes Evaluate, Print page 1, Evaluate, print page 2 and so on.

Here's some info for formatting the header itself and how to print row info at top of the page
 
Upvote 0
Thanks for that I’ve gone for a workaround of defining print ranges and then formulating the headers.
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

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