+ Reply to Thread
Results 1 to 2 of 2

INDEX with dynamic File Path String

  1. #1
    Registered User
    Join Date
    09-14-2016
    Location
    USA
    MS-Off Ver
    Excel 2016
    Posts
    1

    INDEX with dynamic File Path String

    Hello, I was trying to create a table with values from another workbook. I wonder if there is a way to reference part of the filepath linking to an existing excel value.

    For instance, a regular excel value from another workbook can be: ='\\data\my folder\[20160914 Project Summary'!$T$2
    I would like to automate the process by making the link equal to ="\\data\my folder\["&Q4&" Project Summary'!$T$2" where Q4 can be a variable. So every time I change Q4, the filepath automatically updates to the new location.
    The INDIRECT function would not work because it won't work on closed workbooks.

    Thanks a lot for your help!

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,786

    Re: INDEX with dynamic File Path String

    You could put the following code in the module for the worksheet containing this data. Your path is invalid, there is no "]". What is the file name, what is the sheet name? I assumed it was all file name and I added a sheet name. You also didn't say what cell gets this formula, replace or assign the variable appropriately. I compiled but did not test this; I don't have a server to test this filename syntax.

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 09-14-2016 at 01:39 PM. Reason: moved single quote in file path
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Changing connection string path to a dynamic path
    By Shevi in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-11-2014, 05:16 AM
  2. Replies: 0
    Last Post: 05-08-2014, 11:42 AM
  3. [SOLVED] how to insert file path of every file in a folder as a string?
    By Gamekiller48 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-31-2013, 02:01 PM
  4. 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
  5. Dynamic file path
    By GaidenFocus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2011, 12:57 PM
  6. 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
  7. Use String Variables in File Path and create path if not existing
    By JanBang in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-26-2007, 09:04 AM

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