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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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