+ Reply to Thread
Results 1 to 13 of 13

Excel macro - duplication in two lists

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Excel macro - duplication in two lists

    Hey guys,

    I am absolutely new to excel programming, so I would appreciate a little help with my program. I have two lists with datas, both has a column with emails (simply text). I need need to compare those two columns, and if there is a duplicate email in the second list (List2), delete the whole row with the email. To sum it up, each time I need to compare one email from the List1 to plenty of emails from the List2 (that is why I chose 2 for cycles).

    Here is my work, but it does not work at all (there is probably a syntax error in the IF statement).

    Please Login or Register  to view this content.
    Thanks a lot for your help, I really appreciate it
    Last edited by vladozah; 09-01-2012 at 08:00 AM.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Excel macro - duplication in two lists

    Untested but give this a try

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro - duplication in two lists

    Subscript ouf of range
    Emails in List1 are in column F, in the second one are in column C. And there are some empty cells aswell in the columns...

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551
    Can u upload a sample workbook

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel macro - duplication in two lists

    hi vladozah, a bit simpler option, please check attachment

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro - duplication in two lists

    Well this seems to be working fine, thank you buddy! But, how should I modify this macro, when the email column in List1 starts with F2, and in list2 with C3? :-)

    Example: Testovaci.xlsx

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel macro - duplication in two lists

    please check attachment, option for that data layout, run macro "test"
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro - duplication in two lists

    I am really sorry for bothering you so much, but...

    Testovaci.xlsm

    It does not delete all duplicates in this file for example.

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Excel macro - duplication in two lists

    Try this

    Please Login or Register  to view this content.
    Last edited by mike7952; 08-30-2012 at 04:17 PM.

  10. #10
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro - duplication in two lists

    Thank you for another try, but it is still not working with this example: Attachment 177596.

  11. #11
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Excel macro - duplication in two lists

    This should fix you up

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Excel macro - duplication in two lists

    please check attachment
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    08-29-2012
    Location
    Prague
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Excel macro - duplication in two lists

    Yeah, it works! Thank you so much Mr.watersev :-)

+ 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