Page count from multiple tabs

butrosk

New Member
Joined
Feb 26, 2010
Messages
15
I am using Excel 2003. I have some code that works just fine when I want to get the page count from one tab, but when I add code for multiple tabs I get the following error when it gets to the paste command: Run-time error '1004: That command cannot be used on multiple selections. Is there a way to get a page count while selecting multiple tabs? Thanks in advance.

Code:
Windows(CinFileName & ".xls").Activate
    Application.CutCopyMode = False
    Sheets(Array("Confrpt", "PE Phase")).Select
    Pgs = ActiveSheet.PageSetup.Pages.Count
    Selection.Copy
    Windows("CloneConfrpt_TOC.xls").Activate
    Range("H" & Rows.Count).End(xlUp).Offset(1).Value = Pgs
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
could you make the macro loop through the different tabs and assign the page to a variable
pgs = 0
Loop here
pgs = pgs + yourassigned method to count
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,795
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top