Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert new row header after page break

Status
Not open for further replies.

rschneeg

IS-IT--Management
Nov 3, 2004
15
US
I have an excel spreadsheet that has multiple sections.
In one section (starting at row 13) the can be from 1 to n number of rows. The user can insert as many of these as they want. Following that is a different set of data.
How do I repeat the row heading on the next page for the rows in between the fixed sections?

Hope that make sense. See data below. When be tries to go onto the next page I want to repeat the bbbbbbbbbbbbb row.
aaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbb
b1
b2
b3
cccccccccccccccccccccccc
 
Hi,

Excel does not have SECTIONS. That is an MS Word feature.

Excel is best used as one cohesive table per SHEET.

Row headings on each Print PAGE, can be set using File > Page Setup - Sheet Tab: Rows to repeat at top.

Each sheet can have their own headings and column format. You can Select multiple sheet and print them all at once, each with their own page setup parameters.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip.
Not sure I was clear onwhat I wanted. In my example I want the row heading of bbbbbbbbbbbbbbbbb to repeat for every b1, b2, b3 etc until I get to the row with ccccccccccccccccccccc. From what I understand, if I use the page setup and select bbbbbbbbbbbbbbb to repeat then when I hit the row with cccccccccccc it will also repeat if a p[age break is needed.
I only want the row to repeat on page breaks for all of the b1, b2, b3. etc.
I thought about counting the row heights and then inserting a manual page break and this "header row of bbbbbbbbbbbbbbbbb" but there may be an easier way to do it.
Hope that is more clear.
 
What you would have to do is print down to the ccccccc row. Reset the rows to repeat at top and then print the next "section" as you refer to it; Reset the rows to repeat at top and print the THIRD "section" If I were designing it, I'd use named ranges for each Print Area, and loop thru the ranges.

Use you macro recorder to get the code for setting the print area and rows to repeat at top. Post back if you need hep customizing.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip. I understand what you are saying. What I was hoping for was a way I could "trap" the event of a page break and then see if I am in the "range" of rows of the b1, b2, etc.

The problem I have is that the number of b1, b2 and b3 may change as the user inserts rows. I did figure out a way to do a loop through the rows and stop once I hit the cccccccc rows. That worked OK. btw - I removed all page breaks early on in the macro since I noticed some users inserted their own manual page break that was causing problems.

In this Do Loop I was hoping to trap the page break and if I was still in the loop, insert a row to match the bbbbbbbbbbbb header row.

I'm not seeing that how using the macro recorder and doing the page setup, print area, etc would work in my case.

 
I'm not seeing that how using the macro recorder and doing the page setup, print area, etc would work in my case."
[green]
"Grab the stone from my hand, grasshopper."[/green]

Well perhaps you already know the code for that.

PageBreak has no event. VPageBreak is an object, part of the VPageBreaks Collection and a set for horizontal page breaks as well. If you have manual page breaks before each "section" you could loop thru the VPageBreaks collection.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top