Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display worksheet name (2000)

    I seem to recall a simple formula that will display the worksheet name in a cell.. Anyone remember this?? Thanks, Andy.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display worksheet name (2000)

    Hmm, the functions that come to mind (CELL and INFO) don't provide this information (CELL is for compatibility with older spreadsheet programs that didn't have multiple worksheets).

    The following simple VBA function will return the name of the worksheet containing the argument:

    Function WorksheetName(rng As Range)
    WorksheetName = rng.Worksheet.Name
    End Function

    Use it in the form =WorksheetName(P37)

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display worksheet name (2000)

    Thanks. Perhaps I was mistaken.. Maybe I was thinking of the displaying the filename?!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display worksheet name (2000)

    > Maybe I was thinking of the displaying the filename?!
    That is very well possible - it is one of the bits of information you can display with the CELL function.

  5. #5
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Display worksheet name (2000)

    =CELL functions work for the FileName and such. =INFO can give you the path and environment.

    Don't think there is a way to get worksheet name. Probably write a custom function.
    Alan

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Display worksheet name (2000)

    The CELL function gives full path, workbook name and worksheet name.

    You have to use find and mid to extract the pieces in a formula or write a custom function

    Steve

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display worksheet name (2000)

    If the workbook has been saved, then the following formula will work:

    <pre>=MID(CELL("filename",Sheet1!A1),FIND("]",CELL("filename",Sheet1!A1))+1,20)
    </pre>


    If the workbook has not been saved, it will give a #VALUE error.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •