View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Barney Byrd Barney Byrd is offline
external usenet poster
 
Posts: 2
Default Can I include noncontiguous worksheet in array of worksheets?

The following code selects contiguous worksheets 5 through 11.

============

Sub SelectSheets()

Dim Sh() As Variant, wks As Worksheet, i As Integer

i = 0

For Each wks In ActiveWorkbook.Sheets
If wks.Range("E2") = 1 Then
i = i + 1
ReDim Preserve Sh(1 To i)
Sh(i) = wks.Name
End If
Next
Worksheets(Sh()).Select

End Sub

===============

I would like to add one noncontiguous worksheet (#32) to the array of
selected worksheets. Is there a way to do so?


Barney Byrd