+ Reply to Thread
Results 1 to 7 of 7

comparing two named ranges and if at least one match display a message

  1. #1
    Registered User
    Join Date
    05-03-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    4

    comparing two named ranges and if at least one match display a message

    I have two ranges in the same workbook, one which is a static named range and one on a different worksheet that can have different dimensions. Each range contains values, not strings.

    I want a macro that searches the two ranges and if one or more matches is found, displays a message in a specified cell in the worksheet with the unnamed range that says, "match found" .

    thanks

  2. #2
    Registered User
    Join Date
    04-22-2013
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003/2007 & 2010
    Posts
    90

    Re: comparing two named ranges and if at least one match display a message

    Try this, renaming ranges to whatever suites your needs:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-03-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: comparing two named ranges and if at least one match display a message

    That was quick. thanks. I have problems debugging. Have I not defined the variables correctly? see my amended macro:

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 05-03-2013 at 04:12 PM. Reason: Add

  4. #4
    Registered User
    Join Date
    04-22-2013
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003/2007 & 2010
    Posts
    90

    Re: comparing two named ranges and if at least one match display a message

    Please put code between CODE tags. Cell1 and 2 should be dimmed as Ranges. Furthermore you made a little error in stating the range. See below in red.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-03-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: comparing two named ranges and if at least one match display a message

    Thanks. I tried the range datatype before I first replied, but it also bombs on first line referencing cell2. Sorry to be so stupid. I"m a beginner. does it have to do with not naming the active sheet?

  6. #6
    Registered User
    Join Date
    04-22-2013
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003/2007 & 2010
    Posts
    90

    Re: comparing two named ranges and if at least one match display a message

    The code works for named range and range on active sheet yet. Otherwise, instead use, e.g. for named range:
    Please Login or Register  to view this content.
    Otherwise, what error do you get? Attach your workbook to the forum

  7. #7
    Registered User
    Join Date
    05-03-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: comparing two named ranges and if at least one match display a message

    thanks. It now works

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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