View Single Post
 
Old 09-02-2022, 11:44 PM
Marcia's Avatar
Marcia Marcia is offline Windows 11 Office 2021
Expert
 
Join Date: May 2018
Location: Philippines
Posts: 551
Marcia has a spectacular aura aboutMarcia has a spectacular aura aboutMarcia has a spectacular aura about
Default Count number of pages

Hi. I found the below code that counts the number of printed pages. I would like the code to:
1. Show the number of pages in A1 of all the sheets in the workbook, not through msg box. If the selected print area of sheet1 is 10 pages, A1 of sheet1 should show 10. If sheet2 is 5 pages, A1 of sheet2 should also show 5.
2. The number of pages in A1 should be automatically shown.
Thank you.
Code:
Sub PageCount()
  MsgBox (ActiveSheet.HPageBreaks.Count + 1) * _
     (ActiveSheet.VPageBreaks.Count + 1)
End Sub
Reply With Quote