Determine address of pagebreak preview

M

Mark Driscol

If I have text in cell A1 that visually extends over several columns,
viewing the worksheet in Page Break Preview shows the number of
columns that will be printed. Is it possible in VBA to determine what
this Page Break Preview address is, e.g., A1:F1?

Thanks in advance.

Mark
 
A

arjen van...

I'm not sure if you can get the address of the pagebreakview, but you can
return the address of the print area, which should be what you see in the
pagebreak view.

Dim rngPr As String
rngPr = Sheets("Sheet1").PageSetup.PrintArea

Then, if you need, you can extract the column from this string.
 
J

jhvniek

If I have text in cell A1 that visually extends over several columns,
viewing the worksheet in Page Break Preview shows the number of
columns that will be printed.  Is it possible in VBA to determine what
this Page Break Preview address is, e.g., A1:F1?

Thanks in advance.

Mark

Hi I played around and this is my suggestion

Sub Sub_hpagebreaks()


Dim n As Variant

For n = 1 To ActiveSheet.HPageBreaks.Count
Debug.Print ActiveSheet.HPageBreaks(n).Location.Address
Next



End Sub
 

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