List of Worksheets

doug.washburn

New Member
Joined
May 18, 2004
Messages
49
Hello,

I have a workbook with dozens of worksheets inside it all with unique names.
I need to export a list of these worksheets to another document Like another Excel workbook).

I know how to get a list of the tabs from the properties>contents window, but I can't select them all to copy and paste.

Any ideas?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
This will create a list of sheets in a new workbook:

Code:
Sub listsheets()
Dim i As Long, wb As Workbook, ws As Worksheet
Set wb = Workbooks.Add
For Each ws In ThisWorkbook.Worksheets
    i = i + 1
    wb.Sheets("Sheet1").Cells(i, 1).Value = ws.Name
Next ws
End Sub
 
Upvote 0
Great idea, but I'm clearly not doing it right. I get a code snippet called something like FUNCRES.XSLAM, and when I run it I get "RES" in cell A1, nothing else....

???

Hans
 
Upvote 0
Press ALT +F11, from trhe Insert menu select Module. Paste the code into the white space on the right. Press ALT + Q.

Press ALT F8, double click listsheets.
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,462
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top