Results 1 to 6 of 6

Help adapting an existing macro.

Threaded View

  1. #1
    Registered User
    Join Date
    10-08-2008
    Location
    on the edge of insanity!
    Posts
    3

    Help adapting an existing macro.

    Hi,
    First of all this is a great forum and I can honestly say you've all taught me everything I know about VBA (2 whole days experience!).
    Anyway, I've modified this macro I found on this forum, all it does is compares 2 lists of 6 digit serial numbers and and then tells me which numbers are in list 1 that are not in list 2.
    However, I want to modify it so that it also gives me the numbers in list 2 that are not in list 1 (put into column F). I then need it to cut the matching serial numbers (in columns A and B) from sheet 1 and paste them into sheet 2.

    Can anyone help?

    Here's the code for what I have so far.

    Sub copy_duplicate()
        
        Range("D4:D1000").Select
        Selection.ClearContents
        Range("D4").Select
        
        Dim r As Long
        Dim cr As Long
        r = 4
        cr = 4
        On Error Resume Next
        Do While Sheet1.Cells(r, 1) <> ""
           a = Application.WorksheetFunction.VLookup(Sheet1.Cells(r, 1), Range("B:B"), 1, 0)
           
            If a <> "" Then
                
            Else
                Sheet1.Cells(cr, 4) = Sheet1.Cells(r, 1)
                cr = cr + 1
                
            End If
            a = ""
            r = r + 1
        Loop
    End Sub
    Last edited by paul1970; 10-10-2008 at 04:09 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to create a macro?
    By jojotherider in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2008, 08:34 PM
  2. Macro for copy/insert into expanding table
    By Soslowgt in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-06-2008, 07:24 PM
  3. How to splitt texts into words? (collecting word and compounds)
    By wali in forum Excel Programming / VBA / Macros
    Replies: 53
    Last Post: 02-03-2008, 04:06 AM
  4. Conditional formatting macro (highlight macro)
    By c991257 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2007, 02:46 PM
  5. Need macro to move down & select next visible row
    By Fartnuckles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2006, 10:02 PM

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