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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Page Break depending on row values

Status
Not open for further replies.

sagobogger

Technical User
Jun 18, 2004
69
US
Hi folks, back for some more of your great help!

A friend is asking me how to automatically page break a very many row Excel spreadsheet when the value in a column changes. e.g. In the following example page break after the last Cat, last Dog, Otter, Zebra.

Cat
Cat
Cat
Dog
Dog
Otter
Zebra

Is there any conditional formatting way to do that, or what other suggestions does anyone have to do this?

TIA

 




Hi,

Check out Data > Subtotals with the page break option.



Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 
Hi sagobogger:

Assuming your data starts in cell A1, how about using the following VBA code ...
Code:
Range("a2").Select
    Do While ActiveCell.Value <> ""
        If ActiveCell.Value <> ActiveCell(0, 1) Then
            ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
        End If
        ActiveCell(2, 1).Select
    Loop

Yogi Anand, D.Eng, P.E.
Energy Efficient Building Network LLC
 




Hey Yogia,

This is the Office Forum - native application solutions. VBA in Forum707.

Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 




Yet another OP, AWOL???

Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top