ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Display Worksheet in Excel File (https://www.excelbanter.com/excel-discussion-misc-queries/19823-display-worksheet-excel-file.html)

Rowf

Display Worksheet in Excel File
 
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??

Fredrik Wahlgren


"Rowf" wrote in message
...
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



Gord Dibben

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

On Wed, 30 Mar 2005 10:17:03 -0800, "Rowf"
wrote:

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??




All times are GMT +1. The time now is 04:43 AM.

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