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

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?
 
H

Héctor Miguel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top