Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default hpagebreak and vpagebreak

I should have said that the code didn't cause an error. It didn't actually do
what you wanted.

But this may help:

Option Explicit
Sub hpb2()

Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long

With Worksheets(1)
.ResetAllPageBreaks
FirstRow = 36
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = FirstRow To LastRow Step 35
.HPageBreaks.Add Befo=.Cells(iRow, "A")
Next iRow
End With
End Sub



Dave Peterson wrote:

I copied that code and it worked ok for me.

What was the line that caused the error?

btm wrote:

NickHK,

I tried that line of code but I get an error message "Expected: =".

Below is a simplified example of what I'm trying to do. I want to add
pagebreaks every 35 rows.

Sub hpb()
hpbCnt = 0
hpbrow = 0
Worksheets(1).PageSetup.PrintArea = "$A$1:$D$500"
Dim cell As String
Do While hpbCnt < 500
hpbrow = hpbrow + 35
hpbCnt = hpbCnt + 1
cell = "d" & CStr(hpbrow)
Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range(cell)
Loop

End Sub

btm

--
btm
------------------------------------------------------------------------
btm's Profile: http://www.excelforum.com/member.php...o&userid=24880
View this thread: http://www.excelforum.com/showthread...hreadid=384229


--

Dave Peterson


--

Dave Peterson
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
VPageBreak Problem Bill Below Excel Programming 0 December 19th 04 09:47 PM
Hmmm... Excel OVERRIDES vpagebreak and hpagebreak vb code???? wjoc1[_2_] Excel Programming 1 October 14th 04 12:58 PM
Hmmm... Excel OVERRIDES vpagebreak and hpagebreak vb code???? wjoc1 Excel Programming 1 October 14th 04 03:33 AM
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 06:15 AM.

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

About Us

"It's about Microsoft Excel"