ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I print the names of all the sheets in a list? (https://www.excelbanter.com/excel-discussion-misc-queries/244788-how-can-i-print-names-all-sheets-list.html)

Sun

How can I print the names of all the sheets in a list?
 
I have an exceldokument with 30 sheets and would like to print the names of
the sheets in a list. Someone who knows how that works?


Jacob Skaria

How can I print the names of all the sheets in a list?
 
You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub GetSheetNames()
Dim sh As Worksheet, lngRow As Long
For Each sh In ActiveWorkbook.Worksheets
lngRow = lngRow + 1
Range("A" & lngRow) = sh.Name
Next
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"SUN" wrote:

I have an exceldokument with 30 sheets and would like to print the names of
the sheets in a list. Someone who knows how that works?



All times are GMT +1. The time now is 11:43 PM.

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