View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Help with - Sheets(Array(1, 2, 3)).Select

Sub test()
Dim arr() As Long
Dim i As Long, n As Long

ReDim arr(1 To (45 - 2 + 1) + (99 - 60 + 1))

n = 1
For i = 2 To 45
arr(n) = i
n = n + 1
Next

For i = 60 To 99
arr(n) = i
n = n + 1
Next

Sheets(arr).Select

End Sub

I didn't test as written above but something similar with a smaller number
of sheets worked.

Regards,
Peter T


"excelent" wrote in message
...
I can select several sheets with
Sheets(Array(1, 2, 3)).Select
but if i ned to select many sheets, say abot 100 how do i add the
array to do that without writing 1,2,3,4,5,6,7,... manualy ?

by the way is it possible to just add say from 2-45 and 60 to 99 ?

I cant figure this out,
so any help would be greatfull
thanks in advance.