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
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
Dim Arr() As String
Dim N As Long
With ThisWorkbook.Worksheets
ReDim Arr(1 To .Count)
For N = 1 To .Count
Arr(N) = .Item(N).Name
Next N
End With
--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC www.cpearson.com
(email on web site)
Dim Arr() As String
Dim N As Long
With ThisWorkbook.Worksheets
ReDim Arr(1 To .Count)
For N = 1 To .Count
Arr(N) = .Item(N).Name
Next N
End With
--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC www.cpearson.com
(email on web site)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.