Formula returning the worksheet name

D

dminkov

Hi everyone!

Is it possible to write a formula, which returns the name of th
worksheet as a value of the cell?

Waiting for your comments,

Dobri
 
B

Bernard Liengme

This UDF will do it

Function MySheet()
Application.Volatile
MySheet = ActiveSheet.Name
End Function

Call it with =mysheet()
best wishes
 
S

samer.kurdi

The following formula will return path+filename+worksheet name
=CELL("filename",A1)

So, therefore, you can use this formula to get the worksheet name alone
=MID(CELL("filename",A1),1+FIND("]",CELL("filename",A1)),31)

Note that the 31 value above is because a worksheet name can have a max
length of 31.
These formulas point to cell A1 in the current sheet, but can point to
any cell. Also, it is possible for them to point to cells in other
sheets and the formulas will return those other worksheet names. The
formula can also point to its own cell (i.e. the formula can be in A1
and point to A1).
 
Top