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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,223,445
Messages
6,172,177
Members
452,446
Latest member
walkman99

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