make a cell equal a worksheet name

G

Guest

Hi, Lets say I have a worksheet named budget, and I want the name of that
worksheet to appear in a cell, is there a formula that can do that, for
example =budget!, that doesnt seem to work for me, Thanks
 
G

Guest

The following custom function will do it for you.

Function WhoAmI() As String

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ActiveWorkbook
Set ws = wb.ActiveSheet

Application.Volatile
WhoAmI = ws.Name

Set wb = Nothing
Set ws = Nothing

End Function

In Excel, press Alt + F11 to open the VBE. On the VBE menu, click INSERT
and select MODULE. Copy or type the formula above from the line Function
WhoAmI() through End Function inclusive and paste it in the module.

You can then use the function by type =WhoAmI() in the cell of your choice.
 
G

Guest

See if this works for you:

=MID(CELL("filename",$A$1),FIND("]",CELL("filename",$A$1),1)+1,1024)

HTH,
Elkar
 
G

Guest

your the best, that formula so worked, so did the macro, but I really was
looking for a formula, thanks so much

Elkar said:
See if this works for you:

=MID(CELL("filename",$A$1),FIND("]",CELL("filename",$A$1),1)+1,1024)

HTH,
Elkar


cyndi said:
Hi, Lets say I have a worksheet named budget, and I want the name of that
worksheet to appear in a cell, is there a formula that can do that, for
example =budget!, that doesnt seem to work for me, Thanks
 

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