ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate an array with sheet names? (https://www.excelbanter.com/excel-programming/382251-populate-array-sheet-names.html)

Steve

Populate an array with sheet names?
 
I would like to get the tab names in a worksheet into an array. How do I
program this?

Dave Peterson

Populate an array with sheet names?
 
One way:

Option Explicit
Sub testme01()
Dim myArr() As String
Dim iCtr As Long

With ActiveWorkbook
ReDim myArr(1 To .Worksheets.Count)
For iCtr = 1 To .Worksheets.Count
myArr(iCtr) = .Worksheets(iCtr).Name
Next iCtr
End With

End Sub

Steve wrote:

I would like to get the tab names in a worksheet into an array. How do I
program this?


--

Dave Peterson


All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com