what's the function to return a sheetname in a cell in Excel?

P

Peo Sjoblom

The workbook has to be saved first.

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

you can put that anywhere, even in A1

--


Regards,


Peo Sjoblom
 
J

judi

Thank you. I realize now that I am not the first to ask this question. I
appreciate your speedy answer. I will share with my colleagues. Cheers!

Peo Sjoblom said:
The workbook has to be saved first.

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

you can put that anywhere, even in A1

--


Regards,


Peo Sjoblom

judi said:
I was hoping it was this, and it ain't.

=sheetname()

or

=sheet()
 
G

Gord Dibben

It could be if you had a UDF

Function SheetName(Optional ByVal rng As Range) As String
Application.Volatile
If rng Is Nothing Then Set rng = Application.Caller
SheetName = rng.Parent.Name
End Function

=SheetName()

The workbook does not have be saved first.

But the native function Peo posted works a little faster and who would want
to know the sheetname in an unsaved file?


Gord Dibben MS Excel MVP
 

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