ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sheet names code (https://www.excelbanter.com/excel-discussion-misc-queries/117450-sheet-names-code.html)

Jonah

Sheet names code
 
Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah


Dallman Ross

Sheet names code
 
In , Jonah
spake thusly:

Is there away to get the name of a worksheet onto the worksheet
itself in a cell?


With Laurent Longre's SHEETNAME function from his Morefunc
collection, there is.

http://xcell05.free.fr/

-dman-

Sandy Mann

Sheet names code
 
If the sheet has been saved before then you can use:

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

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


with @tiscali.co.uk


"Jonah" wrote in message
...
Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah




T Kirtley

Sheet names code
 
A formula like:

=CELL("filename")

will return the filename, including the full directory path.

If you only want the filename, excluding the directory path try something
like

=MID(CELL("filename"),LEN(INFO("directory"))+1,99)

HTH,

TK

"Jonah" wrote:

Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah



Bob Phillips

Sheet names code
 
See http://www.xldynamic.com/source/xld.xlFAQ0002.html

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jonah" wrote in message
...
Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah




Ken Johnson

Sheet names code
 

Jonah wrote:

Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah


=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))

Returns an empty string until workbook is saved.

Ken Johnson


Dave Peterson

Sheet names code
 
it's best to include a reference to that worksheet that you want:

=cell("filename",a1)
(any cell will do)

If you don't include a cell reference, then this formula will evaluate to the
name of the sheet that's active when excel calculates. It may not even be in
the same workbook!

T Kirtley wrote:

A formula like:

=CELL("filename")

will return the filename, including the full directory path.

If you only want the filename, excluding the directory path try something
like

=MID(CELL("filename"),LEN(INFO("directory"))+1,99)

HTH,

TK

"Jonah" wrote:

Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah



--

Dave Peterson

Chip Pearson

Sheet names code
 
You should add a cell reference (it doesn't matter what cell) to the CELL
functions. E.g.,

CELL("filename",A1)

Without the reference, the value returned by CELL is the workbook/worksheet
that is active when the cell containing the formula is calculated. If a
sheet other than the sheet containing the formula is active, you'll get the
wrong result.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Ken Johnson" wrote in message
ups.com...

Jonah wrote:

Is there away to get the name of a worksheet onto the worksheet itself
in a cell?

Jonah


=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))

Returns an empty string until workbook is saved.

Ken Johnson




Ken Johnson

Sheet names code
 

Chip Pearson wrote:
You should add a cell reference (it doesn't matter what cell) to the CELL
functions. E.g.,

CELL("filename",A1)

Without the reference, the value returned by CELL is the workbook/worksheet
that is active when the cell containing the formula is calculated. If a
sheet other than the sheet containing the formula is active, you'll get the
wrong result.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)


"Ken Johnson" wrote in message
ups.com...


Thanks Chip

Ken Johnson



All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com