View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
SteveM SteveM is offline
external usenet poster
 
Posts: 133
Default How to Create an array

On Feb 2, 9:16 am, "JB" wrote:
I would like to Create an array containing Sheets(3) to Sheets.Count
Is this possible .. if so please advise

Regards & TIA


You already have a built in "array" with the Worksheets collection.
Create a worksheet variable and use that to cycle through the
collection using the For Each construct. I.e.,

Sub SheetDiddle()
Dim ws As Worksheet

For Each ws In ThisWorkbook.Worksheets
If ws.Index = 3 Then
' Do something here
End If
Next

End Sub


SteveM