worksheet name

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

Guest

How can I enter the worksheet name in a cell on the worksheet without haveing
to type it in?
 
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]...
 
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
 
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
 

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

Back
Top