Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
That works great! I am trying to format the borbers to appear around each
cell but I can't get it to limit the formatting to cells with value. I don't want to format more cells than I need to beacuse I'll end printing a bunch of pages of empty boxes. Can the "Dim" command be used for that? "Rick Rothstein" wrote: Give this macro a try (change the worksheet name reference to the worksheet name you want to apply this code to)... Sub AddPageBreaks() Dim X As Long Dim LastRow As Long With Worksheets("Sheet1") .Cells.PageBreak = xlPageBreakNone LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For X = 2 To LastRow If .Cells(X - 1, "B").Value < .Cells(X, "B").Value Then .Rows(X).PageBreak = xlPageBreakManual End If Next .Rows(LastRow + 1).PageBreak = xlPageBreakManual End With End Sub -- Rick (MVP - Excel) "Matt G" wrote in message ... Hi, I'm trying to write a macro that will sort sheet by a particular column "B" and then llok through that column and set a page break whenever the value of any row in comumn "B" changes. For example: A B C 1 r t g ---------------------- Page Break 2 d u w 3 s u e ---------------------- Page Break 4 e v d Any Ideas? Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I can't move my page breaks in Page Break Preview | Excel Discussion (Misc queries) | |||
Different Page Numbers In Worksheet w/Page Breaks | Excel Discussion (Misc queries) | |||
moving page breaks and document format | Excel Discussion (Misc queries) | |||
How do I do page breaks when view menu doesnt page break preview | Excel Discussion (Misc queries) | |||
Page Breaks- Printing selected rows on same page | Excel Discussion (Misc queries) |