worksheet name in cell

imillar

New Member
Joined
Apr 8, 2002
Messages
6
is there a way to insert the worksheet name into a cell
EG:
sheet 1 name is "John"
sheet 2 name is "brian"

on another worksheet "summary" i want to insert these two worksheet names in cells a1 and a2.

regards
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I don't know if this is the easiest way, but this formula seems to work:

=MID(CELL("filename"),FIND("]",CELL("filename"))+1,20)

(Change the 20 at the end of the formula to the maximum length you expect the sheet name might be.)
 
Upvote 0
these work, but what i would really like to do is be able to drag down so it finds the next worksheet name, and the next, etc.....
i have 26 sheets in total
 
Upvote 0
Upvote 0
With a macro?

Code:
Sub Summary()   Dim ws As Worksheet, n As Integer
    Application.ScreenUpdating = False
    n = 1
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Summary" Then
            Sheets("Summary").Range("a" & n) = ws.Name
            n = n + 1
        End If
    Next
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Sorry that came out badly on on the edit.

Code:
Sub Summary()
   Dim ws As Worksheet, n As Integer
    Application.ScreenUpdating = False
    n = 1
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Summary" Then
            Sheets("Summary").Range("a" & n) = ws.Name
            n = n + 1
        End If
    Next
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Suddenly realised this thread is 10 years old???
Nice to know that people still like offering solutions but....
 
Upvote 0
these work, but what i would really like to do is be able to drag down so it finds the next worksheet name, and the next, etc.....
i have 26 sheets in total

I would like to offer a better, more versatile, version of the formula above: MID(CELL("filename"),FIND("]",CELL("filename"))+1,20)

If you copy this formula in 10 different sheets, all 10 formulas will return the result of the ACTIVE sheet. Instead:

MID(CELL("filename",a1),FIND("]",CELL("filename",a1))+1,20)

This formula will return the result of the sheet where the formula exists.


Excel Magic Trick 756: Create Sequential Dates Across Sheets & Extract Sheet Name To Cell - YouTube

The length of 20 is retrictive. I think a sheet name can have 31 chars, the max length allowed. The following does not require such a specification:

=REPLACE(CELL("filename",A1),1,FIND("]",CELL("filename",A1)),"")

By the way, the OP wants to list all sheets...

Define Sheets by means of Insert | Name | Define or Formulas | Name Manager as referring to:

=REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"")

Invoke now in A1 on Summary...

Either:

=IF(ROWS($A$1:A1)<=COUNTA(Sheets),INDEX(Sheets,ROWS($A$1:A1)),"")

Or:

=IFERROR(INDEX(Sheets,ROWS($A$1:A1)),"")
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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