Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Page Numbers in Cells

2,045 views
Skip to first unread message

DC appleyards

unread,
Jul 18, 2005, 6:43:01 AM7/18/05
to
This is what I am doing....

I have a monthly document (identical in appearance but not content) which
can expand or shrink dependant on the number of items which are added to it.
The top section is printed on each page and one of the cells needs to state
the page number… ie Page 1 of 2 etc.

Is there a formula that can be put in the cell that registers the printed
page number?

Dave

Dodo2u

unread,
Jul 18, 2005, 6:58:26 AM7/18/05
to
"=?Utf-8?B?REMgYXBwbGV5YXJkcw==?="
<DCappl...@discussions.microsoft.com> wrote in
news:08DCFC3B-A680-454F...@microsoft.com:

Why not in the header?

View/Header and Footer/Custom header

Barb Reinhardt

unread,
Jul 18, 2005, 6:57:25 AM7/18/05
to
Why not put the page number in the header or footer. Got to Page Setup and
the Header/Footer Tab. Select the pull down menu for header or footer and
page # is an option.

"DC appleyards" <DCappl...@discussions.microsoft.com> wrote in message
news:08DCFC3B-A680-454F...@microsoft.com...


> This is what I am doing....
>
> I have a monthly document (identical in appearance but not content) which
> can expand or shrink dependant on the number of items which are added to
> it.
> The top section is printed on each page and one of the cells needs to
> state

> the page number. ie Page 1 of 2 etc.

Barb Reinhardt

unread,
Jul 18, 2005, 6:59:44 AM7/18/05
to
I'm not sure my first message was sent.

Use Headers or Footers to do this.

File -> Page Setup -> Header/Footer
On the pull down menu, there are several page options.

"DC appleyards" <DCappl...@discussions.microsoft.com> wrote in message
news:08DCFC3B-A680-454F...@microsoft.com...

> This is what I am doing....
>
> I have a monthly document (identical in appearance but not content) which
> can expand or shrink dependant on the number of items which are added to
> it.
> The top section is printed on each page and one of the cells needs to
> state

> the page number. ie Page 1 of 2 etc.

DC appleyards

unread,
Jul 18, 2005, 7:42:02 AM7/18/05
to
Really needs to be on the document... is there any way of doing it?

Earl Kiosterud

unread,
Jul 18, 2005, 11:14:42 AM7/18/05
to
DC,

(1) It appears as though you've laid your sheet out with regard to the
printed pages. That is a lot of trouble. If you haven't looked at the
printing features in File - Page setup, you should first do that. You can
have headings, including automatic page numbers, column and/or row headings
that automatically repeat across the pages, and other things. Now you just
maintain your worksheet as one continuous table, and let Page Setup add the
page stuff for printing.

(2) If you have to have the page numbers on the sheet, the next best
solution would be for a macro, fired by the Before_Print event, to loop
through the pages and put in the numbers into the cells where you want them.
It would have to walk its way through the page breaks, a slow process (the
last time I messed with it), as the PageBreak object is made of molasses.
And kept cold. If you're willing to put a macro in, along with its
ramifications (the user gets the "This workbook contains macros..." message
on opening), we'll write it for you.

(3) Failing that, you'll need to put the page numbers in yourself, into
cells. you'll need to determine where the page breaks are, then use
formulas for each page number. You can use View - Page Break Preview to see
that. Then you could pick a cell in each page, and use a formula that
refers to the prior page number cell. If the prior cell is A1, use:

=A1 + 1

But here's the problem: As you add and delete items, which presumably means
inserting and deleting rows, this will move down or up those page numbering
cells.
--
Earl Kiosterud
www.smokeylake.com

"DC appleyards" <DCappl...@discussions.microsoft.com> wrote in message
news:08DCFC3B-A680-454F...@microsoft.com...

> This is what I am doing....
>
> I have a monthly document (identical in appearance but not content) which
> can expand or shrink dependant on the number of items which are added to
> it.
> The top section is printed on each page and one of the cells needs to
> state

> the page number. ie Page 1 of 2 etc.

DC appleyards

unread,
Jul 19, 2005, 3:32:01 AM7/19/05
to
Earl,

If we put the macro into the document how much will it effect the printing
process?

I am keen to give it a go if it will not effect the document to badly...

Thanks for your help with this.

Dave

Earl Kiosterud

unread,
Jul 19, 2005, 8:53:24 AM7/19/05
to
Dave,

It won't affect printing at all. It will run automatically before the print
takes place, and will calculate and put page numbers in a cell in each page
of the sheet.

The following macro isn't complete. It should be put in a regular module
and gotten working as you want it before you put it in Before_Print for
automatic firing. It will put page numbers in the upper left corner cell of
each page, left pages only. If the worksheet is wider than one page, it
won't do them yet.

Sub pagenumbers()
Dim MyR As Range
Dim PageNumber As Long

Set Mysheet = ActiveSheet
PageNumber = 1
Set MyR = Range("A1") ' starting cell
MyR.Value = "Page " & PageNumber ' first page number

Do While Not Intersect(MyR, ActiveSheet.UsedRange) Is Nothing
If MyR.EntireRow.PageBreak = xlPageBreakAutomatic Then
MyR.Value = "Page " & PageNumber ' put page number in cell
PageNumber = PageNumber + 1
End If
Set MyR = MyR.Offset(1, 0) ' move down
Loop
End Sub

Run this on a copy of the sheet, as it will modify it. Make a new copy each
time you run it.

Consider carefully if you want to remain commited to this page-oriented
worksheet. You'll be precluding a lot of Excel functionality.
--
Earl Kiosterud
www.smokeylake.com

"DC appleyards" <DCappl...@discussions.microsoft.com> wrote in message

news:B5F16962-04EE-470E...@microsoft.com...

DC appleyards

unread,
Jul 19, 2005, 9:10:02 AM7/19/05
to
Earl,

Thanks for your help... I'll give it a go... but I think we might change the
format of the document.

Regards

DC

Earl Kiosterud

unread,
Jul 19, 2005, 12:08:09 PM7/19/05
to
Dave,

Now you're talking. Get familiar with the features in File - Page Setup.
It might just be what you need. If you want the printout in too different a
layout from the table (sheet), and have Access, you can use that for the
report (printout). It lets you lay the report any way you want -- Excel
prints it pretty much as is, with the features in Page Setup. You can
either move the whole application to Access (depending on what it is, that
may or may not be the way to go), or make a linked table to the existing
Excel sheet, which must be in table form, as I mentioned in the earlier
post.
--
Earl Kiosterud
www.smokeylake.com

"DC appleyards" <DCappl...@discussions.microsoft.com> wrote in message

news:5C39E4D4-512C-44B2...@microsoft.com...

Linker IT Software

unread,
Dec 3, 2005, 3:27:42 AM12/3/05
to
Hi Dave,

I have added a function to my litLIB addin that does this. Perhaps you want
to have a look at it: www.oraxcel.com/projects/litlib

I have added the function =PageNumber and =PageCount

Dave Peterson

unread,
Dec 3, 2005, 10:00:32 AM12/3/05
to

David McRitchie

unread,
Dec 4, 2005, 1:39:59 AM12/4/05
to
In other words it is an old thread. For those that don't want to spend money there
are other solutions besides the one in the thread about forcing page breaks.


Here is one of the actual solutions Page # of ## into a cell. by Mrna Larson
http://groups.google.com/group/microsoft.public.excel.misc/msg/0fb2536c782464ff
part of this thread
http://groups.google.com/groups?threadm=379C8919.A9FE3A4B%40bowood.u-net.com

and a solution by Laurent Longre in this thread: using VBA
http://groups.google.com/groups?threadm=38fd6ebe%40news.server.worldonline.co.uk

--
FWIW
I had references to Page number, inserted into a cell, Laurent Longre, Myrna Larson.
but Google has messed them up. that's the who problem with them assigning their own
numbers or in reality recycling the old DejaVue numbers which Google had recognized

This is what I had the reference is good but the references within are bad.
http://groups.google.com/groups?threadm=OWLWQ2qlDHA.3312%40tk2msftngp13.phx.gbl

And I had to look up the references again, unfortunately I could only get the message
number form the first message in each of those threads.

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Dave Peterson" <pete...@verizonXSPAM.net> wrote in message news:4391B310...@verizonXSPAM.net...

Dave Peterson

unread,
Dec 4, 2005, 10:03:45 AM12/4/05
to
And the other thing that scared me was the "hi Dave". I wasn't sure for which
Dave the message was intended.

Thanks for the posting the other solutions.

--

Dave Peterson

David McRitchie

unread,
Dec 4, 2005, 11:12:26 AM12/4/05
to
Hi Dave P.,
There used to be a lot more of us in the Excel newsgroups.
Guess you can thank the people who don't know how to use newsgroups and
instead rely on Microsoft Communities or Excel Forum and who "think" it's appropriate
to use a handle instead of their name (don't get me started on Excel Forum).

What gets me is that only seems to be one Tom and only one Chip in the newsgroups (that I notice).
I guess Tom is not as frequent a name as I thought by Rank in the 1990 US Census
http://www.census.gov/genealogy/www/namesearch.html

shown as name, frequency, cumulative frequency, rank
for David, Tom, Dick, and Harry

male name freq. cumulative RANK
DAVID 2.363 17.176 6
RICHARD 1.703 18.878 7
THOMAS 1.380 23.185 10
HARRY 0.251 52.991 70
TOM 0.117 67.890 154
DAVE 0.053 77.316 271
DICK 0.009 87.298 721

The top ten male names in the US are
James, John, Robert, Michael, William, David, Richard, Charles, Joseph, Thomas

The top ten female names in the US are
Mary, Patricia, Linda, Barbara, Elizabeth, Jennifer, Maria, Susan, Margaret, Dorothy

but then that is probably how they sign their names or what is on birth certificates
If you want to see details for the top 10 names, or link to entire listings see
http://www.census.gov/genealogy/names/names_files.html

There is also a list somewhere for births for more current names.
--


"Dave Peterson" wrote

Dave Peterson

unread,
Dec 4, 2005, 12:28:43 PM12/4/05
to
Interesting data. I wonder what'll happen with the 2000 census.

--

Dave Peterson

Ron Coderre

unread,
Dec 4, 2005, 12:51:02 PM12/4/05
to
Curious about a name???
Check here:
http://babynamewizard.com/namevoyager/lnv0105.html


***********
Regards,
Ron

Dave Peterson

unread,
Dec 4, 2005, 12:55:40 PM12/4/05
to
Pretty neat!

Thanks

0 new messages