+ Reply to Thread
Results 1 to 7 of 7

Application.Evaluate returns Error2015, working in Excel Sheet

  1. #1
    Registered User
    Join Date
    04-30-2013
    Location
    London, United States
    MS-Off Ver
    Excel 2013
    Posts
    74

    Application.Evaluate returns Error2015, working in Excel Sheet

    Dear all,

    I am fairly new to VBA's Application.Evaluate Method.

    Here goes my code:

    Please Login or Register  to view this content.
    formula evaluates to

    "Vlookup("CLCR";'W:\Path1\SubPath2\[UnopenedExternalExcelSheet.xlsb]country pairing'!$A$2:$C$65109;3;FALSE)"

    If I plug this into an ExcelSheet, adding a "=" and removing the opening and closing quotes ("), the vlookup works and i get the desired (and expected) result.

    However, as stated above, in code (VBA), i get error 2015.

    What is going wrong here?


    Thank you!
    Last edited by AliGW; 06-19-2018 at 01:05 PM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    Try replacing the semicolons with commas.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    04-30-2013
    Location
    London, United States
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    Thanks,

    just figured that possibility as well, implemented a semicolon to comma change. Then ran into error 2023. Seems to point, in this case, to VBA not being able to reference / work with unopened workbooks.

    Ran the same code (commas instead of semicolons now) with the UnopenedExternalExcelSheet.xlsb open, and the code now returns what I was hoping for

    Still, is there no simple way to do a VLookup via Aplication.Evaluate on an unopened workbook?

    Thanks!

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    You would have to put the formula into a cell, I think.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    Change to ExecuteExcel4Macro
    e.g
    Please Login or Register  to view this content.
    Accepts only R1C1 notation.

  6. #6
    Registered User
    Join Date
    04-30-2013
    Location
    London, United States
    MS-Off Ver
    Excel 2013
    Posts
    74

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    Thanks. That works. It's very slow compared to Application.Evaluate, but given that Excel isn't designed to be a database, I'll have to live with that. Thanks!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,108

    Re: Application.Evaluate returns Error2015, working in Excel Sheet

    To mark a thread as solved, please do not edit the title. Instead, please select Thread Tools from the menu link above and mark this thread as SOLVED. I've done it for you this time.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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 returns #VALUE! HELP!
    By herbie226 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2018, 09:49 PM
  2. VBA - Evaluate returning #Value although working in a test sheet
    By myDomDom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2017, 06:56 AM
  3. Nested Application.Evaluate not working
    By kaktus018 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-22-2016, 04:18 PM
  4. Application.Evaluate not working - Array Formula
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2015, 01:12 AM
  5. [SOLVED] program working in the code application, but not the excel sheet
    By emilyloz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2013, 09:20 AM
  6. [SOLVED] Evaluate returns #VALUE
    By JohnM3 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-16-2012, 11:46 AM
  7. what exactly evaluate functoin returns?
    By B Deepak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2005, 04:05 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