Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Re-setting HPageBreak

I have an employee scheduling calendar that will dynamically adjust itself
according to the number of employees. How do I get the automatic HPageBreak
to adjust to the last row? For example the previous schedule ended on row
62. That is where the HPageBreak is. After adding some employees the last
row is now 72. Next time there may be fewer employees ending at row 65. How
do I force the HPageBreak to the last row, wherever it is. The VPageBreaks
have already been set and will never change, so I do not want to ReSetAll.

Mike F


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Re-setting HPageBreak

i used something like this before, just change for your needs.

If cell.Row Mod 40 = 0 Then
Sht.HPageBreaks.Add befo=cell
End If

--


Gary


"Mike Fogleman" wrote in message
m...
I have an employee scheduling calendar that will dynamically adjust itself
according to the number of employees. How do I get the automatic HPageBreak to
adjust to the last row? For example the previous schedule ended on row 62. That
is where the HPageBreak is. After adding some employees the last row is now 72.
Next time there may be fewer employees ending at row 65. How do I force the
HPageBreak to the last row, wherever it is. The VPageBreaks have already been
set and will never change, so I do not want to ReSetAll.

Mike F



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Re-setting HPageBreak

Thanks for the input, but I went with something more complex:

Sub SetHPB()
Dim rng As Range, Hrng As Range
Dim LRow As Long
Dim c As Long
c = Worksheets(1).HPageBreaks.Count
If c = 0 Then Exit Sub
LRow = Cells(Rows.Count, "B").End(xlUp).Row + 1
Set rng = Range("A" & LRow)
Set Hrng = Worksheets(1).HPageBreaks(1).Location
If rng.Address = Hrng.Address Then Exit Sub
If Hrng.Row < rng.Row Then
Worksheets(1).HPageBreaks(1).DragOff Direction:=xlDown,
RegionIndex:=1
Else
Worksheets(1).HPageBreaks(1).DragOff Direction:=xlUp, RegionIndex:=1
End If
End Sub

Mike F

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i used something like this before, just change for your needs.

If cell.Row Mod 40 = 0 Then
Sht.HPageBreaks.Add befo=cell
End If

--


Gary


"Mike Fogleman" wrote in message
m...
I have an employee scheduling calendar that will dynamically adjust itself
according to the number of employees. How do I get the automatic
HPageBreak to adjust to the last row? For example the previous schedule
ended on row 62. That is where the HPageBreak is. After adding some
employees the last row is now 72. Next time there may be fewer employees
ending at row 65. How do I force the HPageBreak to the last row, wherever
it is. The VPageBreaks have already been set and will never change, so I
do not want to ReSetAll.

Mike F





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Re-setting HPageBreak

Mike,
You can adjust automatic breaks as they come where required by your
PageSetup setting.
You can .Delete the HPageBreaks that you set then .add one at the correct
location.

Worksheets(1).HPageBreaks(1).Delete

NickHK

"Mike Fogleman" wrote in message
m...
I have an employee scheduling calendar that will dynamically adjust itself
according to the number of employees. How do I get the automatic

HPageBreak
to adjust to the last row? For example the previous schedule ended on row
62. That is where the HPageBreak is. After adding some employees the last
row is now 72. Next time there may be fewer employees ending at row 65.

How
do I force the HPageBreak to the last row, wherever it is. The VPageBreaks
have already been set and will never change, so I do not want to ReSetAll.

Mike F




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HPageBreak Row Oscar Excel Programming 1 May 5th 06 09:05 AM
need help with hpagebreak btm Excel Programming 3 July 5th 05 01:25 PM
hpagebreak and vpagebreak btm Excel Programming 6 July 5th 05 01:10 PM
Hpagebreak help needed please Lars Kofod Excel Programming 3 November 28th 03 03:14 PM
HPageBreak billQ Excel Programming 1 July 24th 03 02:18 AM


All times are GMT +1. The time now is 01:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"