+ Reply to Thread
Results 1 to 6 of 6

Using filename as variable in external reference formula

  1. #1
    Registered User
    Join Date
    04-21-2016
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2016
    Posts
    26

    Using filename as variable in external reference formula

    I am trying to automate several time consuming tasks.
    I have ~25 worker logs used in new worker training.
    I have a summary sheet that gathers information from each of those logs.

    I currently have the log creation process automated, but I would like to automate the creation of the summary sheet as well.
    The log creation process runs several log creation macros in a "For i =1 to lastrowA1" loop.

    One of the variables derived from that loop is myfilenames(i). I want to use the myfilenames(i) variable in formulas, replacing the worker name so that I can run a macro to create the needed external references in the summary view and pull the table data from the individual worker's tables into a master table for analysis.


    Current code:
    Please Login or Register  to view this content.
    What I have tried so far (and doesn't work)
    Please Login or Register  to view this content.
    How can I make this type of formula work, where part of the filename is a variable?


    Attachments:
    Log creator (using module 7 as test module)
    Alison (example worker log)
    Ginny view (summary sheet)
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using filename as variable in external reference formula

    Hi there.

    The Case Review file is password-protected, so it's not possible to test a solution

    I suspect that you might start moving in the right direction if you use the following code:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Last edited by Greg M; 07-25-2016 at 01:15 PM. Reason: Suggestion added

  3. #3
    Registered User
    Join Date
    04-21-2016
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2016
    Posts
    26

    Re: Using filename as variable in external reference formula

    Fixed, sorry.
    Attached Files Attached Files
    Last edited by armlegx; 07-25-2016 at 12:43 PM.

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using filename as variable in external reference formula

    Hi again,

    See the amended version of my previous post.

    Your application is far too complicated for a "quick fix" which can be fully tested by me, but try my previous suggestion and see if it gets you going in the right direction.

    Feel free to shout if you think I can give you any further information.

    Regards,

    Greg M

  5. #5
    Registered User
    Join Date
    04-21-2016
    Location
    Minneapolis, Minnesota
    MS-Off Ver
    2016
    Posts
    26

    Re: Using filename as variable in external reference formula

    It is definitely putting me on the right track.

    I'm getting a sort of error where it is looking for the file to link to, and since the file doesn't exist yet (it opens the open file dialogue box to select the file for the links), the formulas are not going in place after canceling past the dialogue.

    I think I might be trying to be too ambitious and will try another approach to build the summary after the initial logs are done and not as part of the creation process.

    Thanks!

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Using filename as variable in external reference formula

    Hi again,

    You're welcome, and thanks for the feedback.

    One possible suggestion: use Dir to check for the existence of the file, and skip the formula creation steps if the file cannot be located.

    Let me know if you need any further assistance with this.

    Regards,

    Greg M



    P. S. Many thanks for the Reputation increase - much appreciated
    Last edited by Greg M; 08-07-2016 at 05:14 AM. Reason: P. S. added

+ 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. [SOLVED] Using a variable in an external reference
    By pibe31 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-17-2016, 07:48 AM
  2. [SOLVED] How to reference a variable in a filename and table
    By D_N_L in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2014, 07:03 AM
  3. Replies: 2
    Last Post: 06-19-2012, 12:48 PM
  4. External reference with variable filenames
    By donavank in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-02-2008, 12:32 PM
  5. Variable External Reference:
    By fil in forum Excel General
    Replies: 2
    Last Post: 01-18-2008, 06:33 PM
  6. Variable Value to Replace Reference in Filename?
    By TC2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-20-2007, 06:02 PM
  7. External Reference - Filename Change
    By bg18461 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2006, 11:50 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