Put Active Worksheet's Name in a Cell

  • Thread starter Thread starter coreymartin
  • Start date Start date
C

coreymartin

Is there a way to put the active worksheet's name in the cell? Not the
file name of the whole workbook, just the name of the currently
selected sheet.

Thanks for your help.
 
Hi Corey,

There are a few ways this can be done using either macros or functions,
here's one of each:

*=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,
LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
(sourced from Chip Pearson's site, http://www.cpearson.com/excel/excelF.htm)
I recommend checking this page out as it also shows other possibilities.

*Sub InsertSheetNames()
Application.ScreenUpdating = False
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
S.Range("a1").Value = S.Name
Next S
Application.ScreenUpdating = True
End Sub
(sourced from ?, this can be inserted in a module & run as required to put
the respective sheet name in cell A1 of every sheet or adapted & put in the
"this workbook" section to run when the file is opened.)

Hth

Rob Brockett
NZ
 

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