How to extract the number of pages in a cell (Excel 2003)

  • Thread starter Thread starter Vahid
  • Start date Start date
V

Vahid

Hi,
I would like to extract the total number of pages of an Excel file in a cell
so that it is updated automatically.
I need to mention the total number of the printed pages in my document (This
document contains XX pages and may not be reproduced other than in full).

Can you help me?
 
hi, Vahid !
I would like to extract the total number of pages of an Excel file in a cell so that it is updated automatically.
I need to mention the total number of the printed pages in my document
(This document contains XX pages and may not be reproduced other than in full).

*IF* your printed pages refers only to one worksheet (sheet1 ?)
try creating/defining a name using xl4 macro-functions (i.e.)
name formula
nPages =get.document(50+0*now())

use this name on the cell you need to mention that figure (=npages)

hth,
hector.
 
If you mean counting the total pages of a WorkSheet (not the entire Workbook)
then try a UDF to be typed inside a VBA Module:
---------------------------
Function PRT_Pages()
With ActiveSheet
.DisplayAutomaticPageBreaks = True
TotPages = (.HPageBreaks.Count + 1) * (.VPageBreaks.Count + 1)
End With
PRT_Pages = "This document contains " & TotPages & " pages and may not
be reproduced other than in full."
End Function
 
Back
Top