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

cant get page breake address write

Status
Not open for further replies.

Michali

Programmer
Jul 20, 2003
31
0
0
US
hello all
i am using this code to get the pagebreake location so i can put a border line at the end of each page (until row 100):

For j = 1 To ActiveSheet.HPageBreaks.Count
If ActiveSheet.HPageBreaks(j).Location.Row < 100 Then

i = ActiveSheet.HPageBreaks(j).Location.Row
Range(Cells(i - 1, 1), Cells(i, maxcol)).Select
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End If

Next j

for some resone it works fine in several machines but in some others it gives me a wrong pagebreak location.

margins are the same...
any sugestions?
10x

michal
 
michal,

I seem to remember having a similar problem and solving it by setting the View to either Normal or Page Break Preview at the beginning of the routine, I can't remember which.

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
your code has the correct spelling of "break".
 
thank u Skip but unfortunally it dosent work.

any other sugestions?
 
Check out my code in this link and see if it can work for you. It uses the HPageBreaks Collection...

thread68-820318

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hi Skip
your code looks fine only i am having a diffrent problem.
first my pagebreaks are in a pivot table, wich means i'm not sure i can insert conditional formating and certanly i can not insert sings as ~.
second what happens is that pagebreakes that comes becase i fixed a page break at the change of data in a certain coloumn, they come out fine and i get my border correctly.
only those that comes due to a long data (naturally), they some times get wrong and the excel puts the line two rows above.
any sugestions?

michal
 
Michali
It would be easier to read if you check your spelling please.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top