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

C

chris felix

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
 
D

Don Guillett

try
sub listsheets()
for i=1 to worksheets.count
cells(i,1)=sheets(i).name
next i
end sub
 
J

Jacob Skaria

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top