worksheet name

T

Tucson Guy

How can I enter the worksheet name in a cell on the worksheet without haveing
to type it in?
 
C

Chip Pearson

You can use a formula like the following:

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

Leave the "filename" intact as shown. Do NOT replace it with the
actual filename.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



message
news:[email protected]...
 
G

Gord Dibben

Copy/paste this code to a General Module in your workbook.

Function SheetName(Optional ByVal rng As Range) As String
If rng Is Nothing Then Set rng = Application.Caller
SheetName = rng.Parent.Name
End Function

Sub Test()
ActiveCell.FormulaR1C1 = "=SheetName()"
End Sub

Assign Sub Test() to a button or shortcut key combo.

Gord Dibben Excel MVP


On Wed, 8 Sep 2004 16:03:02 -0700, "Tucson Guy" <Tucson
 
S

SidBord

You can write a one-line Visual Basic macro.
I called mine "SheetName".
Try this:
Function SheetName() As String
SheetName = Range("A1").Parent.Name
End Function
 
Top