Can I get the page number of a cell?

1445 views
Skip to first unread message

tony bolding

unread,
Apr 19, 2000, 3:00:00 AM4/19/00
to
I am trying to find out the page number of a particular cell so that I can
create a page summary.

I can't find out how to get the page number of any specific cell though.

Any help gratefully received.

Regards
Tony.

Patrick Molloy

unread,
Apr 19, 2000, 3:00:00 AM4/19/00
to
by page you mean sheetname?

if the file has been saved, then you could use =CELL("Filename")
you can use FIND and MID functions to extract the sheet name.

--
Patrick Molloy
Microsoft Excel MVP
www.xl-expert.com pat...@NOSPAMxl-expert.com
_________________________________


"tony bolding" <nospam...@atlantisuk.com> wrote in message
news:38fd...@news.server.worldonline.co.uk...

Myrna Larson

unread,
Apr 19, 2000, 3:00:00 AM4/19/00
to
On Wed, 19 Apr 2000 09:31:19 +0100, "tony bolding"
<nospam...@atlantisuk.com> wrote:

>I am trying to find out the page number of a particular cell so that I can
>create a page summary.
>
>I can't find out how to get the page number of any specific cell though.
>
>Any help gratefully received.

If you mean the page number if the current sheet were to be printed, then this
requires a macro, and it's, in fact, quite lengthy. I have developed a macro
which does the equivalent of Word's Print Current Page. If you are interested
in some code, let me know.

Laurent Longre

unread,
Apr 21, 2000, 3:00:00 AM4/21/00
to
tony bolding a écrit :

>
> I am trying to find out the page number of a particular cell so that I can
> create a page summary.
>
> I can't find out how to get the page number of any specific cell though.

Dim VPC As Integer, HPC As Integer
Dim VPB As VPageBreak, HPB As HPageBreak
Dim NumPage As Integer

If ActiveSheet.PageSetup.Order = xlDownThenOver Then
HPC = ActiveSheet.HPageBreaks.Count + 1
VPC = 1
Else
VPC = ActiveSheet.VPageBreaks.Count + 1
HPC = 1
End If
NumPage = 1
For Each VPB In ActiveSheet.VPageBreaks
If VPB.Location.Column > ActiveCell.Column Then Exit For
NumPage = NumPage + HPC
Next VPB
For Each HPB In ActiveSheet.HPageBreaks
If HPB.Location.Row > ActiveCell.Row Then Exit For
NumPage = NumPage + VPC
Next HPB
MsgBox "Page number of the active cell = " & NumPage

Laurent

Chuck Bishop

unread,
Apr 21, 2000, 3:00:00 AM4/21/00
to
Use the print select area
"Laurent Longre" <laurent...@free.fr> wrote in message
news:39006BB0...@free.fr...

Laurent Longre

unread,
Apr 22, 2000, 3:00:00 AM4/22/00
to

This ng is not excel.misc, but excel.programming.

Laurent

Reply all
Reply to author
Forward
0 new messages