Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default PageBreak in VBA???

I'm trying to set page breaks (via VBA) for a dynamic range (involving
RowStart). Can someone please direct me to what i need the 2nd line statement
to equal. currently it says "SELECTION" because i don't know what to enter.

ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), Cells(RowStart - 1,
11)).Select
Set ActiveSheet.HPageBreaks(1).Location = SELECTION

Thanks for your time and energy,
-m
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default PageBreak in VBA???

Maybe something like this - adjust to suit.

Dim rng as Range
dim RowStart as Long
RowStart = Cells(rows.count,1).End(xlup).Row
set rng = Range(Cells(1, 1), Cells(RowStart - 1, 11))
ActiveSheet.PageSetup.PrintArea = rng.Address(External:=True)
Activesheet.HpageBreaks.Add Befo=rows(RowStart)
rng.Select

Although I am not sure why you want a manual pagebreak beyond your printarea.

--
Regards,
Tom Ogilvy



"mvyvoda" wrote:

I'm trying to set page breaks (via VBA) for a dynamic range (involving
RowStart). Can someone please direct me to what i need the 2nd line statement
to equal. currently it says "SELECTION" because i don't know what to enter.

ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), Cells(RowStart - 1,
11)).Select
Set ActiveSheet.HPageBreaks(1).Location = SELECTION

Thanks for your time and energy,
-m

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
Cant move pagebreak in PageBreak View in Excel2003 Vasanthan Excel Worksheet Functions 1 August 22nd 07 03:28 PM
determine pagebreak using VBA mirec Excel Programming 2 April 15th 05 01:36 PM
PageBreak-broke? nope Excel Programming 13 January 11th 05 03:54 PM
PageBreak Problems Don Lloyd Excel Programming 1 December 11th 04 02:21 PM
How to pagebreak Bilal A F Excel Programming 1 November 13th 03 06:57 PM


All times are GMT +1. The time now is 09:57 PM.

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"