Getting Cell Address Of Each Page Within a Print Range

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I use this code to set up my print area ...
Code:
With ws_front.PageSetup
        .PrintArea = "$J7:BM" & lr
        pgnums = .Pages.Count
    End With

Is there a way I can compile the cell address of each page? I want to loop through each page and get the interior colour of the cell offst by 6 rows and 8 columns) from the top left corner of the page.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
VBA Code:
ws_front.HPageBreaks(1).Location 'this will return a range object (cell) just after the first horisontal pagebreak

ws_front.HPageBreaks(1).Location.Address 'and this is the address

ws_front.HPageBreaks(ws_front.HPageBreaks.Count-1).Location ' this is the top left cell of the last page - unless you have multiple column print layout
change the 1 to check the next page breaks
use VPageBreaks(index) for the vertival page breaks if any
 
Upvote 0

Forum statistics

Threads
1,215,874
Messages
6,127,473
Members
449,384
Latest member
purevega

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top