+ Reply to Thread
Results 1 to 2 of 2

Evaluate Method Calling to another Workbook

  1. #1
    Registered User
    Join Date
    01-27-2017
    Location
    Vallejo, U.S.A.
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Evaluate Method Calling to another Workbook

    Hello,
    I am trying to use a VBA module function to allow me to pull information from another workbook based on inputs in some cells.
    I am trying to do this by trying to have a function that will run a string as a formula.

    For example, I have four files:
    Calculator.xlsm
    \\Server\Front\New.xlsm
    \\Server\Front\Old.xlsm
    \\Server\Back\New.xlsm
    \\Server\Back\Old.xlsm

    In Calculator.xlsm I have in my Modules:
    Please Login or Register  to view this content.
    And in cell C1 I have:

    =EVAL(CONCATENATE("'\\Server\",A1,"\[",B1,".xlsx]Sheet1'!A1"))
    So that A1 will determine which Folder the file is in, and B1 will determine what the File Name is, and C1 would get the information from whichever file that is.

    This doesn't work. From what I can tell and what I read, this method only works on the active Workbook and gives a #REF! error when trying to call to another Workbook like this.

    For example, if I simply do the following in Calculator.xlsm cell D2:

    =EVAL(CONCATENATE("Sheet",A2,"!",B2,C2))
    This will get the information from whichever Sheet number is specified in cell A2, the column specified in cell B2, and the row specified in cell C2 and give the proper output in cell D2, as long as I don't switch to work on another Workbook, for when I do it will draw from the cell identified but in that other Workbook, unless it can't find that a Sheet with that number in that Workbook, in which case I will get a #REF! error.

    Is there something I can add to the code to work beyond the active Workbook, or a different method I could use?

    I would very much appreciate the help.

    Thank you for your time.
    Last edited by ADMial; 03-27-2018 at 03:53 PM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,962

    Re: Evaluate Method Calling to another Workbook

    Use code in the change event to create a linking formula to the workbook of interest. Below is code that creates links to a chosen workbook - you should be able to modify it easily to do what you want.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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] EVALUATE Method 13 runtime error
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-05-2017, 08:10 AM
  2. [SOLVED] EVALUATE Method error
    By chief_abound in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2017, 06:32 AM
  3. [SOLVED] How to use COUNTIF() function within Evaluate Method
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-17-2014, 01:34 AM
  4. [SOLVED] Replace Nth Character-EVALUATE method
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2012, 01:54 PM
  5. A More Efficient Method Than the Evaluate Method?
    By anthony.mcgovern in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-22-2011, 05:39 AM
  6. Strange (?) Evaluate Method Behavior
    By Johnny Meredith in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-03-2006, 10:30 AM
  7. [SOLVED] Evaluate method - UDFs and Formulas
    By mo_in_france in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2005, 05:06 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