LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default Selecting more than one sheet

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
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
Selecting rows to another sheet Muskrat24 Excel Worksheet Functions 2 June 23rd 09 05:04 PM
Selecting sheet with VB RobN[_2_] Excel Discussion (Misc queries) 14 May 23rd 08 01:36 AM
Selecting Last Sheet Bonbon Excel Worksheet Functions 17 February 22nd 06 04:16 PM
Selecting sheet Fernando Gomez Excel Programming 0 September 2nd 04 03:50 PM
Selecting a sheet by code name Dr.Schwartz Excel Programming 2 August 25th 04 03:34 PM


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