![]() |
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? |
All times are GMT +1. The time now is 11:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com