+ Reply to Thread
Results 1 to 2 of 2

Import info from closed workbook

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Import info from closed workbook

    I am using the following code that pulls numbers from a closed book based on book name with the cell. It keeps showing error at line: "LR = ExecuteExcel4Macro("match(" & myMax & "," & myFormula & "c1:c1,1)")" - any help would be greatly appreciated as I am not too familiar with VBA very much. This is the full code that I am using and I am attaching my workbook so you can see what this supposed to do.
    Please Login or Register  to view this content.
    For my example: The workbook called "Danielle Barrigar" would pull the numbers & finds the name in workbook "Captain" on sheet "ART Yearly Numbers" and put based off the date in the agents sheet. Any help would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Import info from closed workbook

    Hello Jamesraywebber85,

    The Excel4Macro Match follows the same rules as the Excel Match function. In your case, if the array in the closed workbook is not sorted in ascending order then you will receive an error.

    Also, if Match fails to find a match then an #N/A error is returned. This will generate another error in the VBA code since you have dimension LR as Long. You would need to dimension LR as Variant to accept either a number or error value. Of course, you would then need to check if LR returned a error value in your code and provide a handler for the error.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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. Import sheet from a closed workbook
    By tejay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2016, 12:12 PM
  2. userform to add info to closed workbook
    By jagsweb in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-13-2015, 04:55 PM
  3. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  4. Import all sheets from closed workbook to the open workbook
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-10-2013, 04:05 AM
  5. Replies: 1
    Last Post: 11-26-2011, 09:10 PM
  6. locating info in a closed workbook
    By Lisa Coombes in forum Excel General
    Replies: 5
    Last Post: 11-14-2008, 10:28 AM
  7. Macro to look up info from a closed workbook
    By hunsnowboarder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2007, 04:59 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