Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default page numbering in an Excel cell

On Tuesday, July 27, 1999 at 3:00:00 AM UTC-4, Myrna Larson wrote:
On Mon, 26 Jul 1999 22:22:55 -0400, "David McRitchie"
wrote:

you can thank Dana for the concept, which is really
remarkable


I agree. Those old XLM macro functions are really far back in my mind. But they
can get you out of all sorts of jams like this problem of how many pages there
are in the printed document. I'm really surprised there's no VBA command for
this.

Anyway, if you want the page number on all pages, it needs one more change to
get rid of the part that excludes page 1:

Sub Demo()
Dim TotalPages As Long
Dim pg As Long

TotalPages = ExecuteExcel4Macro("Get.Document(50)")
For pg = 1 To TotalPages
With ActiveSheet
.Range("D5").Value = pg & " of " & TotalPages '<<< CHANGE HERE
.PrintOut From:=pg, To:=pg
End With
Next pg
End Sub


I like this macro but how do you start from the first page and I ran it and it would change the current page number it would make it equal to the total pages.
Here is the one I am using.

Sub Pages()
Dim TotalPages As Long
Dim pg As Long


TotalPages = ExecuteExcel4Macro("Get.Document(50)")
For pg = 1 To TotalPages
With ActiveSheet

.Range("F1").Value = pg & " _ " & TotalPages

End With
Next pg
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert automatic page numbering into a cell, not a header or foote Catherine D Excel Discussion (Misc queries) 1 September 11th 09 12:04 AM
start page numbering from page 2 in excel swa Excel Discussion (Misc queries) 2 July 25th 07 04:53 PM
how to insert page numbering in an excel cell Kevin Excel Discussion (Misc queries) 0 November 16th 05 10:45 PM
Need Help with Excel page numbering uclabennett New Users to Excel 0 October 5th 05 04:55 PM
page numbering in excel Michelle F Excel Discussion (Misc queries) 0 September 29th 05 08:56 PM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"