Sunday, 6 July 2014

Excel VBA Macro to Store Each Sheet Name in an Array

Macro to Store Each Sheet Name in an Array
Sub ShtNamesIntoArray()

Dim SheetNames() As String
ReDim SheetNames(1 To ActiveWorkbook.Sheets.Count) ' Resizing Array

For X = 1 To Sheets.Count
SheetNames(X) = Sheets(X).Name
Next X

'To display the sheet name First Column of Active Sheet
For X = 1 To Sheets.Count
ActiveSheet.Cells(X, 1) = SheetNames(X)
Next X

End Sub

To Understand More about Arrays , go through the below Links :






No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts