#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 211
Default Page Number in cell

Hello I created a purchase order template. I need to show the number of
pages of the purchase order, but not in a header or footer.
Example Cell F10 is " No. Pages" (means the no of pages for the purchase
order) cell G11 should automatically populate number of pages ( 2, 3 or
how many papges there are for the order.)
How can I do this? thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Page Number in cell

Sub Pages_In_Cell()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub

Or event code in Thisworkbook module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub


Gord Dibben MS Excel MVP


On Sun, 7 Oct 2007 13:16:04 -0700, Marilyn
wrote:

Hello I created a purchase order template. I need to show the number of
pages of the purchase order, but not in a header or footer.
Example Cell F10 is " No. Pages" (means the no of pages for the purchase
order) cell G11 should automatically populate number of pages ( 2, 3 or
how many papges there are for the order.)
How can I do this? thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Page Number in cell

Is there a way to do this, but instead of referencing total pages, to
reference the page number of a specific page/sheet from the work book (so say
I switch the position of the sheet from the last page to the third page, how
to I make sure that the cell will track that change).

Ben

"Gord Dibben" wrote:

Sub Pages_In_Cell()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub

Or event code in Thisworkbook module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.Range("G11") = TotPages
ActiveSheet.PrintOut
End Sub


Gord Dibben MS Excel MVP


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
How to display current page number in any cell of that page. Laljeet Excel Discussion (Misc queries) 8 February 2nd 08 01:31 AM
To show page number in a cell Florence Excel Worksheet Functions 2 March 31st 07 07:50 PM
how to insert a page number in a cell Raf Excel Worksheet Functions 1 March 19th 07 02:30 PM
sheet tabs as page number and in a cell page of pages? [email protected] Excel Discussion (Misc queries) 0 November 22nd 05 02:43 PM
Page Number of a cell [email protected] Excel Worksheet Functions 2 October 26th 05 12:07 PM


All times are GMT +1. The time now is 11:39 PM.

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

About Us

"It's about Microsoft Excel"