10-11-2022, 01:48 PM
|
|
Expert
|
|
Join Date: May 2013
Location: USA
Posts: 700
|
|
So you already have a VBA program that calculates the number of pages, and displays it using MsgBox, right? If you want your program to put that number in a cell of a worksheet, the code looks something like this:
Code:
set ows = ActiveSheet
npg = (ows.HPageBreaks.Count + 1) * (ows.VPageBreaks.Count + 1)
set ocs = ows.Cells
ocs(1, 1).Value = npg 'row 1, col 1
There are other ways to code it; this is the way I probably would.
|