+ Reply to Thread
Results 1 to 4 of 4

Excel Matching Macro

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Excel Matching Macro

    Hi all,

    Hope all is well.

    Here to consult with the macro saavy to illuminate the error of my ways!

    I've written a macro to compare data from one sheet to another and, if the data if not found in the latter, insert that data at the end of that sheet.

    Unfortunately, though the macro runs, it does not seem to insert the missing data!

    I would really appreciate any input on this!

    Please Login or Register  to view this content.

    Many thanks for any and all help! If you could explain any errors / improvements / theory I am missing I would greatly appreciate it.


    Coeus.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Excel Matching Macro

    I'm guessing the problem is that you define and test EEENAME but you assign your range to EEERange.

    So EEENAME is empty, when you test if it's an array it returns false, so skips to the end.

    Try changing:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

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

    Re: Excel Matching Macro

    Your biggest problem is that you haven't used Option Explicit at the top of your module to require variable declarations - if you had, you would have been warned that EEERANGE had not been declared.
    But there is no need to transfer the values to an array:

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

  4. #4
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Excel Matching Macro

    Many thanks both ragulduy and Bernie Deitrick!!!

    That has worked perfectly however a simple adaption (or so I thought) doesnt seem to be working as I would like.

    The idea is once the macro finds the first empty cell it inserts an additional row and then selects the first empty cells to put in the unmatched variable.

    Could you provide any further advice? It would be greatly much appreciated

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Excel Matching Macro

    It would be easier to analyse with an example of your data to test it on, but I don't think you can do this:
    Please Login or Register  to view this content.
    I'm not sure there is such a thing as application.match, I think you mean application.worksheetfunction.match. However, I don't think you can test if it is an error like that, I think it would just say "unable to get worksheetfunction match" or something if it was going to result in an error. Maybe try doing something like:
    Please Login or Register  to view this content.
    instead.

+ 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. Matching Macro
    By kartikeyadawar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-11-2014, 06:42 AM
  2. [SOLVED] Matching Macro, Matching Dr. to Cr.
    By kartikeyadawar in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-15-2013, 12:19 AM
  3. Excel - Arranging, Matching & Presenting data using a macro.
    By AliJay in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2010, 01:49 AM
  4. row matching macro.
    By mkozakov in forum Excel General
    Replies: 3
    Last Post: 05-07-2009, 07:14 AM
  5. Excel Macro: Matching and calculating 2 worksheets
    By mayanair in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2006, 02:05 AM

Tags for this Thread

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