Sheet Name Formula

A

art

Hello:

I would like to write a custom formula that will give the name of the sheet.
The formula should work something like this: =SheetName(X), and X represents
the sheet number in that worksheet.

Please let me know.

Thanks.
 
M

Mike H

Hi,

How about a UDF.

Alt +F11 to open VB editor. Right click 'This Workbook' and sert module and
paste the code below in on the right.

call with
=Sheetname(n) wher n is the sheet number. I've included 2 options the sheet
name as appears on the Tab or the sheet codename. Use which one you want.

Function sheetname(cdname As Integer)
sheetname = Sheets(cdname).CodeName
'sheetname = Sheets(cdname).Name
End Function

Mike
 
A

art

Thanks, this is exactly what I needed. It's much easier to use then using the
Filename.... Formula.
 
Top