Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Counting pages for tab

G'day All

Would anyone know the macro to count the number of pages each that would
print out for each tab.

For example you had 3 tabs.
First one is the summary page (where the answer to this question goes)
Second one has data in it and prints out 5 pages
Third one has 3 pages.

So the answer would be (assuming starting at A1)
1
5
3

Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Counting pages for tab

Based on the code shown he http://www.ozgrid.com/VBA/printed-pages.htm
Modified, we can come up with this macro

Sub HowManyPagesBreaks()
Dim iHpBreaks As Integer, iVBreaks As Integer
Dim iTotPages As Integer

iHpBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count + 1
iTotPages = iHpBreaks * iVBreaks

Range("A1") = iTotPages
'get 2nd sheet's page count
'change Sheet2 to actual tab name
iHpBreaks = Worksheets("Sheet2").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet2").VPageBreaks.Count + 1
Range("A2") = iHpBreaks * iVBreaks
'get 3rd sheet's page count
'change Sheet3 to actual tab name
iHpBreaks = Worksheets("Sheet3").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet3").VPageBreaks.Count + 1
Range("A3") = iHpBreaks * iVBreaks
End Sub

"Art Vandelay" wrote:

G'day All

Would anyone know the macro to count the number of pages each that would
print out for each tab.

For example you had 3 tabs.
First one is the summary page (where the answer to this question goes)
Second one has data in it and prints out 5 pages
Third one has 3 pages.

So the answer would be (assuming starting at A1)
1
5
3

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Counting pages for tab

Thanks JLatham,

It wasn't what I was exactly after, but it did point me in the right
direction.
So thanks, for without your help I would still be floundering.
If I get the whole thing working I might post it for everyone.
Basically I'm trying to create a Table of Contents with page (not tabs)
numbers that work with a variable number of tabs.

"JLatham" wrote:

Based on the code shown he http://www.ozgrid.com/VBA/printed-pages.htm
Modified, we can come up with this macro

Sub HowManyPagesBreaks()
Dim iHpBreaks As Integer, iVBreaks As Integer
Dim iTotPages As Integer

iHpBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count + 1
iTotPages = iHpBreaks * iVBreaks

Range("A1") = iTotPages
'get 2nd sheet's page count
'change Sheet2 to actual tab name
iHpBreaks = Worksheets("Sheet2").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet2").VPageBreaks.Count + 1
Range("A2") = iHpBreaks * iVBreaks
'get 3rd sheet's page count
'change Sheet3 to actual tab name
iHpBreaks = Worksheets("Sheet3").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet3").VPageBreaks.Count + 1
Range("A3") = iHpBreaks * iVBreaks
End Sub

"Art Vandelay" wrote:

G'day All

Would anyone know the macro to count the number of pages each that would
print out for each tab.

For example you had 3 tabs.
First one is the summary page (where the answer to this question goes)
Second one has data in it and prints out 5 pages
Third one has 3 pages.

So the answer would be (assuming starting at A1)
1
5
3

Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Counting pages for tab

Thanks JLatham,

It wasn't what I was exactly after, but it did point me in the right
direction.
So thanks, for without your help I would still be floundering.
If I get the whole thing working I might post it for everyone.
Basically I'm trying to create a Table of Contents with page (not tabs)
numbers that work with a variable number of tabs.

"JLatham" wrote:

Based on the code shown he http://www.ozgrid.com/VBA/printed-pages.htm
Modified, we can come up with this macro

Sub HowManyPagesBreaks()
Dim iHpBreaks As Integer, iVBreaks As Integer
Dim iTotPages As Integer

iHpBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count + 1
iTotPages = iHpBreaks * iVBreaks

Range("A1") = iTotPages
'get 2nd sheet's page count
'change Sheet2 to actual tab name
iHpBreaks = Worksheets("Sheet2").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet2").VPageBreaks.Count + 1
Range("A2") = iHpBreaks * iVBreaks
'get 3rd sheet's page count
'change Sheet3 to actual tab name
iHpBreaks = Worksheets("Sheet3").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet3").VPageBreaks.Count + 1
Range("A3") = iHpBreaks * iVBreaks
End Sub

"Art Vandelay" wrote:

G'day All

Would anyone know the macro to count the number of pages each that would
print out for each tab.

For example you had 3 tabs.
First one is the summary page (where the answer to this question goes)
Second one has data in it and prints out 5 pages
Third one has 3 pages.

So the answer would be (assuming starting at A1)
1
5
3

Thanks in advance.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Counting pages for tab

If you need more help, get in touch directly via email - the system here
hasn't notified me of a response to a post in weeks. Remove spaces:
Help From @ JLatham Site.com

"Art Vandelay" wrote:

Thanks JLatham,

It wasn't what I was exactly after, but it did point me in the right
direction.
So thanks, for without your help I would still be floundering.
If I get the whole thing working I might post it for everyone.
Basically I'm trying to create a Table of Contents with page (not tabs)
numbers that work with a variable number of tabs.

"JLatham" wrote:

Based on the code shown he http://www.ozgrid.com/VBA/printed-pages.htm
Modified, we can come up with this macro

Sub HowManyPagesBreaks()
Dim iHpBreaks As Integer, iVBreaks As Integer
Dim iTotPages As Integer

iHpBreaks = ActiveSheet.HPageBreaks.Count + 1
iVBreaks = ActiveSheet.VPageBreaks.Count + 1
iTotPages = iHpBreaks * iVBreaks

Range("A1") = iTotPages
'get 2nd sheet's page count
'change Sheet2 to actual tab name
iHpBreaks = Worksheets("Sheet2").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet2").VPageBreaks.Count + 1
Range("A2") = iHpBreaks * iVBreaks
'get 3rd sheet's page count
'change Sheet3 to actual tab name
iHpBreaks = Worksheets("Sheet3").HPageBreaks.Count + 1
iVBreaks = Worksheets("Sheet3").VPageBreaks.Count + 1
Range("A3") = iHpBreaks * iVBreaks
End Sub

"Art Vandelay" wrote:

G'day All

Would anyone know the macro to count the number of pages each that would
print out for each tab.

For example you had 3 tabs.
First one is the summary page (where the answer to this question goes)
Second one has data in it and prints out 5 pages
Third one has 3 pages.

So the answer would be (assuming starting at A1)
1
5
3

Thanks in advance.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting pages for tab Art Vandelay[_2_] Excel Discussion (Misc queries) 0 December 7th 09 05:57 AM
How do I delete pages in Excel? Keeps printing blank pages at end. Jojobean Charts and Charting in Excel 1 May 31st 07 07:37 AM
Need Help -- Baseball stats in excel only has 23 pages--Need to addmore pages.. GE Cathey Setting up and Configuration of Excel 7 May 17th 07 09:42 PM
Need Help -- Baseball stats in excel only has 23 pages--Need to addmore pages... GE Cathey Excel Worksheet Functions 1 May 16th 07 08:17 PM
How do I delete pages from an Excell template of mutiple pages pulcom123 Excel Discussion (Misc queries) 2 December 30th 05 04:41 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"