how do I display the current worksheet name in a cell?

G

Guest

I want a function like =INFO() or =CELL() that returns the name of the
current worksheet, e.g. =CELL("WorkSheetName"). Is there such a function?
 
P

Peo Sjoblom

The workbook has to be saved first

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

A1 is irrelevant in this case, what the formula needs is a single cell
reference, it can be any not just A1 and it can be put in any cell including
A1
 
G

Guest

Try this:

=MID(CELL("FILENAME",A1),FIND("]",CELL("FILENAME",A1))+1,999)

Note, that the workbook must be saved in order for this to work.

HTH,
Elkar
 
G

Guest

Try,

=MID(CELL("filename"),SEARCH("]",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Mike
 
G

Guest

Thanks a lot - that works! very clever, I didn't realise the filename
function returned the tab name.

Elkar said:
Try this:

=MID(CELL("FILENAME",A1),FIND("]",CELL("FILENAME",A1))+1,999)

Note, that the workbook must be saved in order for this to work.

HTH,
Elkar


JayJay said:
I want a function like =INFO() or =CELL() that returns the name of the
current worksheet, e.g. =CELL("WorkSheetName"). Is there such a function?
 
P

Peo Sjoblom

You need to use a cell reference or it will return the sheet name of the
last sheet that was changed


=MID(CELL("filename",A1),SEARCH("]",CELL("filename",A1))+1,SEARCH("]",CELL("filename",A1))-SEARCH("[",CELL("filename",A1))-1)



--
Regards,

Peo Sjoblom



Mike H said:
Try,

=MID(CELL("filename"),SEARCH("]",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Mike

JayJay said:
I want a function like =INFO() or =CELL() that returns the name of the
current worksheet, e.g. =CELL("WorkSheetName"). Is there such a
function?
 
G

Guest

Thanks Peo, you're right.

Peo Sjoblom said:
You need to use a cell reference or it will return the sheet name of the
last sheet that was changed


=MID(CELL("filename",A1),SEARCH("]",CELL("filename",A1))+1,SEARCH("]",CELL("filename",A1))-SEARCH("[",CELL("filename",A1))-1)



--
Regards,

Peo Sjoblom



Mike H said:
Try,

=MID(CELL("filename"),SEARCH("]",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Mike

JayJay said:
I want a function like =INFO() or =CELL() that returns the name of the
current worksheet, e.g. =CELL("WorkSheetName"). Is there such a
function?
 
G

Guest

Absolutely right, I tried to do a quick cheat on this formula and never
consiodered the consequences :)

=MID(CELL("filename"),SEARCH("[",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Mike

Peo Sjoblom said:
You need to use a cell reference or it will return the sheet name of the
last sheet that was changed


=MID(CELL("filename",A1),SEARCH("]",CELL("filename",A1))+1,SEARCH("]",CELL("filename",A1))-SEARCH("[",CELL("filename",A1))-1)



--
Regards,

Peo Sjoblom



Mike H said:
Try,

=MID(CELL("filename"),SEARCH("]",CELL("filename"))+1,
SEARCH("]",CELL("filename"))-SEARCH("[",CELL("filename"))-1)

Mike

JayJay said:
I want a function like =INFO() or =CELL() that returns the name of the
current worksheet, e.g. =CELL("WorkSheetName"). Is there such a
function?
 

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