+ Reply to Thread
Results 1 to 4 of 4

Referencing File Path - Dynamic Cell Input for Worksheet

  1. #1
    Registered User
    Join Date
    12-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Referencing File Path - Dynamic Cell Input for Worksheet

    Hello,

    I have the following formula:

    Please Login or Register  to view this content.
    In workbook1 that references workbook2 having multiple worksheets (sheet1,sheet2,sheet3,etc....)

    What I would like to do is reference a cell in workbook1 that contains the correct sheet number (ie. if I type "sheet2" in cell A1,workbook1, it will reference workbook2,sheet2)

    Something like this:

    Please Login or Register  to view this content.
    where A1 = sheet2

    Is this possible? I have seen the INDIRECT() function being thrown around but used in context of referencing the filepath location, not the sheet name after the file location.

    Thanks in advanced,
    Chomie.

  2. #2
    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,929

    Re: Referencing File Path - Dynamic Cell Input for Worksheet

    Hi and welcome to the forum

    INDIRECT() can be used to "convert" any text into a format that excel will understand. However, INDIRECT only works on open workbooks.

    The formula might look something like this...

    =INDIRECT("'[workbook"&row(A1)&".xlsx]sheet"&ROW(A1)&"'!$I$53")/1000 (untested)

    There is an add-in called Morefunc that modifies INDIRECT() to allow its use with closed workbooks
    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

  3. #3
    Registered User
    Join Date
    12-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Referencing File Path - Dynamic Cell Input for Worksheet

    That did the trick!

    =INDIRECT("'[worksheet2.xlsx]"&K3&"'!$I$53")/1000

    Thanks,
    Chomie.

  4. #4
    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,929

    Re: Referencing File Path - Dynamic Cell Input for Worksheet

    Happy to help and thanks for the feedback

+ 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. Macro to save sheet as CSV using a dynamic file name and file path
    By chris.tinta in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2013, 10:45 AM
  2. Replies: 5
    Last Post: 03-21-2013, 07:34 AM
  3. Dynamic file path
    By GaidenFocus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2011, 12:57 PM
  4. Macro to check dynamic file path and create if does not exist
    By Matso in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2011, 01:56 AM
  5. Dynamic path for a file used in the vbscript
    By mosu90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-26-2008, 04:24 AM

Tags for this Thread

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