Display Worksheet in Excel File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to Display the worksheet name on the Excel Spreadsheet itself.

ie. On Worksheet1, Cell A1 = Worksheet1

How do I do this without having C:\Desktop\Book1.xls\Worksheet1??
 
Rowf said:
I want to Display the worksheet name on the Excel Spreadsheet itself.

ie. On Worksheet1, Cell A1 = Worksheet1

How do I do this without having C:\Desktop\Book1.xls\Worksheet1??

You have to make a User Defined Function. Start the Visual Basic Editor,
insert a new module and enter

Public Function wks() As String
wks = Application.Caller.Parent.Name
End Function

Now, if you enter =wks() in a cell in any worksheet, wks will return the
name of that worksheet.

/Fredrik
 
Rowf

Enter in any cell on a sheet.

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

File must have been saved at least once.


Gord Dibben Excel MVP
 
Back
Top