ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet Name Formula (https://www.excelbanter.com/excel-programming/419071-sheet-name-formula.html)

Art

Sheet Name Formula
 
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.

Mike H

Sheet Name Formula
 
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

"art" wrote:

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.


Art

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

"Mike H" wrote:

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

"art" wrote:

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.



All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com