+ Reply to Thread
Results 1 to 6 of 6

Retrieve worksheet name embedded in link formula

  1. #1
    Registered User
    Join Date
    07-22-2016
    Location
    Nowhere
    MS-Off Ver
    2013
    Posts
    5

    Retrieve worksheet name embedded in link formula

    So, I have two workbooks open that do different things, but have the same worksheet names. I want to link a column of data from the first workbook to the second workbook by worksheets with the same name. From searching, I've found this formula...

    =REPLACE(CELL("Filename",A1),1,FIND("]",CELL("filename",A1)),"")

    which will accurately display the current worksheet name. In cell C6, I've tried these two formulas to make the link from the first workbook to the second workbook...

    1. ='[workbook1.xlsx]REPLACE(CELL("Filename",A1),1,FIND("]",CELL("filename",A1)),"")'!$AP4

    2. I also placed this formula REPLACE(CELL("Filename",A1),1,FIND("]",CELL("filename",A1)),"") in cell A1, and it displays worksheet1 correctly, and tried these two formulas
    a. ='[workbook1.xlsx]A1'!$AP4
    b. ='[workbook1.xlsx]Indirect(A1)'!$AP4

    The error I get every time says "A formula in this worksheet contains one or more invalid references. Verify that your formulas contain a valid path, workbook, range name, and cell reference."

    I have tons of worksheets in both workbooks, so if anyone could help me, that'd be awesome.
    Last edited by MufasaFury; 08-03-2016 at 10:21 AM.

  2. #2
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Retrieve worksheet name embedded in link formula

    you need to use INDIRECT for all path with folder, filename, workshhetname and cell
    a source must be opened
    imho, macro will do it better

  3. #3
    Registered User
    Join Date
    07-22-2016
    Location
    Nowhere
    MS-Off Ver
    2013
    Posts
    5

    Re: Retrieve worksheet name embedded in link formula

    So you're saying that I should do =Indirect('[workbook1.xlsx]A1'!$AP4)?

    I don't know macros at all

  4. #4
    Forum Expert tim201110's Avatar
    Join Date
    10-23-2011
    Location
    Russia
    MS-Off Ver
    2016, 2019
    Posts
    2,357

    Re: Retrieve worksheet name embedded in link formula

    this way Indirect("'path\[workbook1.xlsx]A1'!$AP4")
    never late to learn

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Retrieve worksheet name embedded in link formula

    If both files are open (which they need to be for INDIRECT to work), you wont need the path.

    The syntax would look something like this...
    =INDIRECT("["&A25&".xlsb]storage!A11")
    where A25 contains the file name

    Adjust the extension, sheet name and cell ref as needed
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    07-22-2016
    Location
    Nowhere
    MS-Off Ver
    2013
    Posts
    5

    Re: Retrieve worksheet name embedded in link formula

    Thanks for the quick replies! I'll try these suggestions

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. link embedded video to activex control
    By vurbileron in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-15-2015, 06:06 AM
  2. Link to an embedded PDF
    By Senor Chuy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2013, 12:52 PM
  3. Conditional link to embedded objects
    By zogus2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2011, 11:20 AM
  4. Link to Embedded Object (OLE)
    By Chaosphere in forum Excel General
    Replies: 3
    Last Post: 09-28-2011, 03:23 PM
  5. Link To Embedded Object
    By Brainfire in forum Excel General
    Replies: 0
    Last Post: 06-21-2006, 09:45 AM
  6. Pulling Embedded LInk Out of Cell
    By bobbabuoy in forum Excel General
    Replies: 2
    Last Post: 04-14-2006, 07:55 AM
  7. [SOLVED] Formula to retrieve range of dates from a worksheet to calculate d
    By accented in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2006, 05:55 PM

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