+ Reply to Thread
Results 1 to 4 of 4

compare values and copy new values to clipboard

Hybrid View

  1. #1
    Registered User
    Join Date
    09-13-2005
    Posts
    59

    compare values and copy new values to clipboard

    I need a macro which compares the values of the cells in two different sheets "A" and "B" and copies to the clipboard all cells which are in sheet "A" but not in sheet "B".

    This macro needs to very efficient as I have a lot of data to compare !

    also this has to be a macro approach and not formula if anybody was wondering..

    could anyone help please?
    thanks in advance
    andy

  2. #2
    Registered User
    Join Date
    09-13-2005
    Posts
    59
    i have got this code

    Dim c As Range
    Dim r As Range
    Dim Book1_Range As Range
    Dim i As Double
    Dim sht1 As Worksheet
     
        Set Book1_Range = Sheets("Match").Range("M12:M1512") 
         
        For Each c In Sheets("Match").Range("N12:N1512") 'Range("N1512").End(xlUp)
            Set r = Book1_Range.Find(c, LookIn:=xlValue, lookat:=xlWhole, MatchCase:=True)
            If r Is Nothing Then
                i = i + 1
                Sheets("Match").Cells(i + 11, 28) = c.Value
            End If
             
        Next c
    but i get an error "subscript out of range" in line
    Set r = Book1_Range.Find(c, LookIn:=xlValue, lookat:=xlWhole, MatchCase:=True)

    any ideas why ?
    thankss

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    I'd try
    Set r = Book1_Range.Find(What:=c.Value , LookIn:=xlValue, lookat:=xlWhole, MatchCase:=True)

  4. #4
    Registered User
    Join Date
    09-13-2005
    Posts
    59
    i still get the same error message but thanks for the interest...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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