+ Reply to Thread
Results 1 to 4 of 4

tab name in the body of a worksheet - &[TAB]?

Hybrid View

  1. #1
    HR Duvall
    Guest

    tab name in the body of a worksheet - &[TAB]?

    I am trying to find an easy way to insert the tab name in the body of the
    worksheet. I know in headers & footers you can use &[TAB] but I can't seem
    to make that work in the worksheet. Any help will be greatly appreciated.

  2. #2
    Chip Pearson
    Guest

    Re: tab name in the body of a worksheet - &[TAB]?

    Try the following formula:

    =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

    The workbook must have been saved to disk for this to work. Note
    that you need the word "filename" in the formula, as it is
    written, NOT the actual filename. You can replace the A1 with any
    cell you like. It doesn't matter which cell you use, just so long
    as it is on the same worksheet.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "HR Duvall" <HRDuvall@discussions.microsoft.com> wrote in message
    news:5526B767-151D-4F7C-8C02-F2675BB220A1@microsoft.com...
    >I am trying to find an easy way to insert the tab name in the
    >body of the
    > worksheet. I know in headers & footers you can use &[TAB] but
    > I can't seem
    > to make that work in the worksheet. Any help will be greatly
    > appreciated.




  3. #3
    HR Duvall
    Guest

    Re: tab name in the body of a worksheet - &[TAB]?

    WOW!! I'm not sure how you did it but it works perfectly. I am trying to
    understand how the formula but it's beyond me. Thanks you very much!!
    Helen

    "Chip Pearson" wrote:

    > Try the following formula:
    >
    > =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
    >
    > The workbook must have been saved to disk for this to work. Note
    > that you need the word "filename" in the formula, as it is
    > written, NOT the actual filename. You can replace the A1 with any
    > cell you like. It doesn't matter which cell you use, just so long
    > as it is on the same worksheet.
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    >
    > "HR Duvall" <HRDuvall@discussions.microsoft.com> wrote in message
    > news:5526B767-151D-4F7C-8C02-F2675BB220A1@microsoft.com...
    > >I am trying to find an easy way to insert the tab name in the
    > >body of the
    > > worksheet. I know in headers & footers you can use &[TAB] but
    > > I can't seem
    > > to make that work in the worksheet. Any help will be greatly
    > > appreciated.

    >
    >
    >


  4. #4
    Chip Pearson
    Guest

    Re: tab name in the body of a worksheet - &[TAB]?

    It is actually a fairly simple formula.

    CELL("filename",A1) returns a string with the full filename and
    the worksheet name. For example

    "H:\[Book1.xls]Sheet1

    The FIND function looks in this string for the ']' character and
    returns its position in the string. The next character after the
    ']' is the beginning of the sheet name, so we add 1 to the result
    of FIND.

    The MID function returns a portion of a string. You pass it the
    string itself, the starting point within the string, and the
    number of characters to return.

    In this case, we pass the string returned by CELL("filename",A1),
    to MID, and the result of FIND +1 as the starting point. For the
    number of characters, we pass 255. This can be any number longer
    than the maximum length of a sheet name, which is currently 31.

    The purpose of the A1 in the CELL command is to ensure that CELL
    references the same sheet as the formula.

    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "HR Duvall" <HRDuvall@discussions.microsoft.com> wrote in message
    news:1A5320B9-AD20-4877-85AE-83C1EB064987@microsoft.com...
    > WOW!! I'm not sure how you did it but it works perfectly. I
    > am trying to
    > understand how the formula but it's beyond me. Thanks you very
    > much!!
    > Helen
    >
    > "Chip Pearson" wrote:
    >
    >> Try the following formula:
    >>
    >> =MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)
    >>
    >> The workbook must have been saved to disk for this to work.
    >> Note
    >> that you need the word "filename" in the formula, as it is
    >> written, NOT the actual filename. You can replace the A1 with
    >> any
    >> cell you like. It doesn't matter which cell you use, just so
    >> long
    >> as it is on the same worksheet.
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >>
    >>
    >> "HR Duvall" <HRDuvall@discussions.microsoft.com> wrote in
    >> message
    >> news:5526B767-151D-4F7C-8C02-F2675BB220A1@microsoft.com...
    >> >I am trying to find an easy way to insert the tab name in the
    >> >body of the
    >> > worksheet. I know in headers & footers you can use &[TAB]
    >> > but
    >> > I can't seem
    >> > to make that work in the worksheet. Any help will be
    >> > greatly
    >> > appreciated.

    >>
    >>
    >>




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1