Determine address of pagebreak preview

  • Thread starter Thread starter Mark Driscol
  • Start date Start date
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
 
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.
 
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
 
Back
Top