ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   i have a file with 50 worksheets, how can I print these names (https://www.excelbanter.com/excel-worksheet-functions/251413-i-have-file-50-worksheets-how-can-i-print-these-names.html)

chris felix

i have a file with 50 worksheets, how can I print these names
 
I have a file that has 50 worksheets, I am trying to print the names of the
worksheets so that I can incorporate into a new file. I made some changes to
the new file and we added about 20 new sheets to the old file so I am looking
for a way to print these names as opposed to writing them all out.

I thank you in advance for your assistance and consideration.

CRF

Don Guillett

i have a file with 50 worksheets, how can I print these names
 
try
sub listsheets()
for i=1 to worksheets.count
cells(i,1)=sheets(i).name
next i
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"chris felix" <chris
wrote in message
...
I have a file that has 50 worksheets, I am trying to print the names of the
worksheets so that I can incorporate into a new file. I made some changes
to
the new file and we added about 20 new sheets to the old file so I am
looking
for a way to print these names as opposed to writing them all out.

I thank you in advance for your assistance and consideration.

CRF



Jacob Skaria

i have a file with 50 worksheets, how can I print these names
 
Hi Chris

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 Macro()
Dim ws As Worksheet, lngRow As Long
For Each ws In Worksheets
lngRow = lngRow + 1
Range("A" & lngRow) = ws.Name
Next
End Sub

--
Jacob


"chris felix" wrote:

I have a file that has 50 worksheets, I am trying to print the names of the
worksheets so that I can incorporate into a new file. I made some changes to
the new file and we added about 20 new sheets to the old file so I am looking
for a way to print these names as opposed to writing them all out.

I thank you in advance for your assistance and consideration.

CRF



All times are GMT +1. The time now is 10:02 PM.

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