ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine address of pagebreak preview (https://www.excelbanter.com/excel-programming/431859-determine-address-pagebreak-preview.html)

Mark Driscol[_4_]

Determine address of pagebreak preview
 
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


arjen van...

Determine address of pagebreak preview
 
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.

jhvniek

Determine address of pagebreak preview
 
On Jul 31, 4:16*pm, Mark Driscol wrote:
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


All times are GMT +1. The time now is 10:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com