Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Insert Sheet Name in Cell on Sheet

Status
Not open for further replies.

dsmith910

Technical User
Jan 16, 2003
127
GB
Hi

Does anyone know how to insert the name of a sheet in one of the cells of the same sheet, i.e. if the sheet tab is named 'Sheet 14' is it possible to get that to appear in a cell on that sheet?

I know you can get it to show in the footer on a sheet when its printed by entering &[tab] - but what else do I have to add when adding it in a cell? - if its possible that is?

Doreen
 
Hi

You could write a macro for it. Here is how;

Sub getSheetName()
Dim ShtName As String
ShtName = ActiveSheet.Name
ActiveCell.Value = ShtName
End Sub

Hope this help

LSTAN
 
coupla ways
1: UDF
Function sheetname()
sheetname = activesheet.name
end function
Enter this into a public module and in a cell on the worksheet, enter
=sheetname()
2:Look at my FAQ in this section:
faq68-2561 Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
You could use a formula to get the sheet name from the CELL function, like this :

=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,99)

which is fairly simple.

Glenn.
 
and also in my FAQ ;-) Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top