Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I tried Jake's suggestion and it works great. Is there a way to do it without declaring the number of elements in the array or setting it as a variable? I want to use it to select and move up 85 worksheets to another wookbook and save it. I try setting it at the max, but I keep getting an error -- Run-time error '9': "Subscript out of range" -- Regards, Tim "Jake Marx" wrote: Hi Steve, Steve wrote: Dim Sh1 As String Dim Sh2 As String Sh1 = "Sheet1" Sh2 = "Sheet3" Sheets(Array(Sh1, Sh2)).Select Thanks for the quick reply. This will work if I want to select 2 sheets but it does not allow me to select a range of worksheets, i.e. - Sheet1, Sheet2, ...., Sheet 23. Something like this may do what you want: Dim asSheets(22) As String Dim lSht As Long For lSht = 1 To 23 asSheets(lSht - 1) = "Sheet" & CStr(lSht) Next lSht Sheets(asSheets).Select -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting rows to another sheet | Excel Worksheet Functions | |||
Selecting sheet with VB | Excel Discussion (Misc queries) | |||
Selecting Last Sheet | Excel Worksheet Functions | |||
Selecting sheet | Excel Programming | |||
Selecting a sheet by code name | Excel Programming |