Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Sheets(array) method for printing grouped worksheets

arySheets(3) is by default arySheets(0 to 3), so you leave arySheets(3)
as empty and that causes the error.

Regards,
Tom Ogilvy


"Keith Bishton" wrote in message
...
I often group sheets to print and I am trying to develop a
way to automate the process. I am able to add sheet names
to a list box, add the selected sheet names in the list
box to any array. But when I try to apply the elements of
the array using the Sheets(array) method I get a "Subcript
out of range" error.

For example:

Dim arySheets(3)
arySheets(0) = "Sheet1"
arySheets(1) = "Sheet2"
arySheets(2) = "Sheet3"

For i = 0 to Ubound(arySheets)
Sheets(arySheets(i)).Select
'trying to imitate
'Sheets(Array("Sheet1","Sheet2","Sheet3").Select
Next

Comments, suggestion, work arounds?



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
not printing grouped columns Erol Excel Discussion (Misc queries) 2 May 7th 09 09:31 PM
Printing Footers on Grouped Worksheets ExcelNovice Excel Discussion (Misc queries) 1 September 27th 07 02:47 PM
Printing a group that is not grouped jerminski73 Excel Discussion (Misc queries) 2 May 22nd 07 07:38 PM
Select sheets from an array for printing bennyob Excel Discussion (Misc queries) 2 November 24th 05 02:03 PM
printing an array of worksheets Marco de Witte Excel Discussion (Misc queries) 4 December 8th 04 04:21 PM


All times are GMT +1. The time now is 08:47 AM.

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

About Us

"It's about Microsoft Excel"