PageBreak in VBA???

G

Guest

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
 
G

Guest

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 Before:=rows(RowStart)
rng.Select

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top