Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert automatic page numbering into a cell, not a header or foote | Excel Discussion (Misc queries) | |||
start page numbering from page 2 in excel | Excel Discussion (Misc queries) | |||
how to insert page numbering in an excel cell | Excel Discussion (Misc queries) | |||
Need Help with Excel page numbering | New Users to Excel | |||
page numbering in excel | Excel Discussion (Misc queries) |