ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I lookup a worksheet name in excel? (https://www.excelbanter.com/excel-worksheet-functions/189352-how-do-i-lookup-worksheet-name-excel.html)

RJL007

How do I lookup a worksheet name in excel?
 
Is there a function in Excel that will return the name of the current
worksheet as a text string?

If not a function, is there some other way of looking up the current
worksheet's name (perhaps VB) and saving/displaying it in a cell?

Rick Rothstein \(MVP - VB\)[_574_]

How do I lookup a worksheet name in excel?
 
There are two ways to interpret "name of the current worksheet". If you mean
the function is on, say, Sheet3 in cell A1 and you are on Sheet2 with a
reference to that cell (=Sheet3!A1) and you want to see the name of the
sheet that the sheet the function is actually on, then use this...

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

in A1 on Sheet3. But if, instead, what you want is the name of the active
sheet (that is, the sheet name that the =Sheet3!A1 formula is on, then leave
the cell references out of the above formula...

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

Rick


"RJL007" wrote in message
...
Is there a function in Excel that will return the name of the current
worksheet as a text string?

If not a function, is there some other way of looking up the current
worksheet's name (perhaps VB) and saving/displaying it in a cell?



Rick Rothstein \(MVP - VB\)[_575_]

How do I lookup a worksheet name in excel?
 
I should mention... in order for the formulas I posted to work, the workbook
needs to be saved first, otherwise the CELL function call will return and
empty string.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
There are two ways to interpret "name of the current worksheet". If you
mean the function is on, say, Sheet3 in cell A1 and you are on Sheet2 with
a reference to that cell (=Sheet3!A1) and you want to see the name of the
sheet that the sheet the function is actually on, then use this...

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

in A1 on Sheet3. But if, instead, what you want is the name of the active
sheet (that is, the sheet name that the =Sheet3!A1 formula is on, then
leave the cell references out of the above formula...

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

Rick


"RJL007" wrote in message
...
Is there a function in Excel that will return the name of the current
worksheet as a text string?

If not a function, is there some other way of looking up the current
worksheet's name (perhaps VB) and saving/displaying it in a cell?





All times are GMT +1. The time now is 02:40 AM.

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