Returns the name of the worksheet in a given position.

iSheetNoThe number of the worksheet you want the name of.


  • You can also get the name of the worksheet by using the CELL function.

  • MID(CELL("filename",A1)), FIND("]",CELL("filename",A!)) + 1, 1000)

Option Explicit 

Public Function SHEETNAME(Optional ByVal iSheetNo As Integer = -1) As String

   If iSheetNo = -1 Then
      SHEETNAME = Application.ActiveSheet.Name
      SHEETNAME = Application.Sheets(iSheetNo).Name
   End If

End Function

Copyright © 2001 - 2016 Better Solutions Limited | All Rights Reserved.    Previous