Tom’s Tutorials For Excel: Count Your Workbook’s Total Printable Pages
Ever want to know how many total pages would print from all your workbook’s worksheets?
This macro will tell you:
Sub GetPrintablePageCount() Dim iSheet%, iCountStart%, iCountEnd% iCountStart = 0: iCountEnd = 0 For iSheet = 1 To Worksheets.Count If Sheets(iSheet).Visible = xlSheetVisible Then Sheets(iSheet).Activate iCountStart = iCountEnd + 1 iCountEnd = iCountEnd + ExecuteExcel4Macro("INDEX(GET.DOCUMENT(50),1)") MsgBox "The sheet named " & Sheets(iSheet).Name & vbCrLf & _ "has its printable pages starting at number " & iCountStart & vbCrLf & _ "and ending at number " & iCountEnd, , "Running count of printable sheets" End If Next iSheet End Sub
Leave a Reply