Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I'm trying to create a simple sub that will group a series of sheet and print out the group. For example, if I have sheet1, sheet2, and sheet3, I want the sub to select all three sheets and print them out (not cycle them but select them.) So, I can do this: Sub Foo() Worksheets(Array("Sheet1","Sheet2","Sheet3")).Prin tout End Sub but I can't understand why I can't do this: Sub Foo2() Dim i as Integer Dim strSheets() as String Dim r as Range Set r = Range("ListOfSheetToPrintIsHere") With r ReDim strSheets(0 to .Cells.Count-1) For i = 0 to .Rows.Count-1 strSheets(i)=.Cells(i).Value Next End With Worksheets(strSheets).PrintOut Erase strSheets() Set r = Nothing End Sub I get an subscript out of range error on the Worksheets(strSheets.... line. I can't simply use the array functions for the sheets I want to select and print because I don't know at design time what sheets the user will want to group print. Thanks, Johnny |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Grouping on protected worksheets | Excel Worksheet Functions | |||
Printing Excel Worksheets | Excel Discussion (Misc queries) | |||
Grouping and moving worksheets by name using VBA? | Excel Programming | |||
grouping hidden worksheets | Excel Discussion (Misc queries) | |||
printing worksheets in Excel | Excel Discussion (Misc queries) |