Mark McInerney
Active Member
- Joined
- Apr 4, 2012
- Messages
- 291
- Office Version
- 365
- Platform
- Windows
Hi All,
I have 52 sheets, and I want to run a macro that I found online to retrieve the name of all the worksheets and place them in a specific row or column (not fussy - just need the data).
I found this, and press ALT +F11, paste it into the immediate pane, but nothing happens??
Am I doing something wrong - is there an easier way of retrieving the info that I am looking for?? Any Help - Appreciated. Thanks - Mark.
Sub ListSheetNames()
*** Dim R As Range
*** Dim WS As Worksheet
*** Set R = ActiveCell
*** For Each WS In ThisWorkbook.Worksheets
******* R.Value = WS.Name
******* Set R = R(2, 1)
*** Next WS
End Sub
I have 52 sheets, and I want to run a macro that I found online to retrieve the name of all the worksheets and place them in a specific row or column (not fussy - just need the data).
I found this, and press ALT +F11, paste it into the immediate pane, but nothing happens??
Am I doing something wrong - is there an easier way of retrieving the info that I am looking for?? Any Help - Appreciated. Thanks - Mark.
Sub ListSheetNames()
*** Dim R As Range
*** Dim WS As Worksheet
*** Set R = ActiveCell
*** For Each WS In ThisWorkbook.Worksheets
******* R.Value = WS.Name
******* Set R = R(2, 1)
*** Next WS
End Sub