Gets a sheet name by referencing sheet ID or Sheet No
This is more likely to be used as User-Defined-Function (or UDF) inside Excel workbook, but it also can be used as function, especially since we now have Sheet() and Sheets() functions.
http://xlfxs.com/sheet-and-sheets/
Function SheetName(SheetNo)
' Gets sheet name for a given id in thisworkbook
If SheetNo > ThisWorkbook.Worksheets.Count Then
SheetName= "#N/A"
Else
SheetName= ThisWorkbook.Worksheets(SheetNo).Name
End If
End Function
' Gets sheet name for a given id in thisworkbook
If SheetNo > ThisWorkbook.Worksheets.Count Then
SheetName= "#N/A"
Else
SheetName= ThisWorkbook.Worksheets(SheetNo).Name
End If
End Function
SheetNo
Views 5,001
Downloads 1,388
CodeID
DB ID
ANmarAmdeen
607
Revisions
v1.0
Thursday
August
23
2018