using tab name in cells

G

Guest

i have a budget with a bunch of sheets. The first sheet (sheet1) is to be a
summary sheet.

In the summary sheet I'd like to be able to make a cell name dependent on
the tab name of other sheets. That way I only have to change the name in one
place.

For instance in the summary sheet the first column will be all the sheet names

item1 (sheet 2 name)
item2 (sheet 3 name)
item3 (shhet 4 name)

where each item is a sheet name. If there a formula to do it?
 
G

Guest

Here is some code:

Sub listum()
Dim w As Worksheet
Dim s(100) As String
For Each w In Worksheets
w.Activate
s(i) = ActiveSheet.Name
i = i + 1
Next
Sheets(1).Activate
For j = 1 To i
Cells(j, 1) = s(j - 1)
Next
End Sub
It runs thru all the tabs, collecting tab names. Then it goes back to the
first sheet and writes the tabs in the first column.
 

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