Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calculate Number Of Sheets To Print In VBA

Hello

I have a pivot table on a sheet, which can at any time require upto
pages to print. Along side the pivot report there are also VLOOKU
formular retreiving data from another sheet based on the results of th
pivot report, so as a result I cannot simply allow excel to decide th
number of sheets, as it allways selects 5 to print out the VLOOKU
data, which is empty, but surrounded by borders. I use a simple COUNT
formula to calculate how many sheets will be required.
The result of this COUNTA is placed into cell G5 and then rounded up i
cell G6.

Can I alter the code below to make the To:=X, where X is the figur
found in cell G6?


ActiveWindow.SelectedSheets.PrintOut From:=1, To:=5, Copies:=1
Collate:=True

Could I simply alter the To:=5 part to:

To:=(Range.("G6))

or something similar, or will I need to define a range name?


Thanks in advance!

Celtic_Avenger
:confused

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calculate Number Of Sheets To Print In VBA

I would qualify it with a the sheet on which it is located.

worksheets("Sheet1").PrintOut From:=1, _
To:=Worksheets("Sheet1").Range("G6").Value, _
Copies:=1, _
Collate:=True


--
Regards,
Tom Ogilvy

"Celtic_Avenger " wrote in
message ...
Hello

I have a pivot table on a sheet, which can at any time require upto 5
pages to print. Along side the pivot report there are also VLOOKUP
formular retreiving data from another sheet based on the results of the
pivot report, so as a result I cannot simply allow excel to decide the
number of sheets, as it allways selects 5 to print out the VLOOKUP
data, which is empty, but surrounded by borders. I use a simple COUNTA
formula to calculate how many sheets will be required.
The result of this COUNTA is placed into cell G5 and then rounded up in
cell G6.

Can I alter the code below to make the To:=X, where X is the figure
found in cell G6?


ActiveWindow.SelectedSheets.PrintOut From:=1, To:=5, Copies:=1,
Collate:=True

Could I simply alter the To:=5 part to:

To:=(Range.("G6))

or something similar, or will I need to define a range name?


Thanks in advance!

Celtic_Avenger



---
Message posted from http://www.ExcelForum.com/



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
calculate total number of items that meet 2 over multiple sheets twototango Excel Worksheet Functions 5 May 29th 08 07:04 PM
How do I print sheets in Excel without blank sheets after page Peggy New Users to Excel 2 January 12th 08 11:10 AM
Print a selected number of sheets RobN[_3_] Excel Discussion (Misc queries) 9 June 8th 07 12:28 PM
How to print a selected number of sheets? Rafat Excel Worksheet Functions 0 June 9th 06 02:50 PM
i made one spreadsheet but when i try to print two sheets print, yokhan Excel Discussion (Misc queries) 1 August 14th 05 09:24 AM


All times are GMT +1. The time now is 01:54 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"