+ Reply to Thread
Results 1 to 3 of 3

How to merge and weedout duplicates

  1. #1
    Registered User
    Join Date
    12-04-2006
    Posts
    4

    How to merge and weedout duplicates

    I am new to excel VBA and wondering does the below is easy enough to do in excel macro/vba script, or should i resort to Perl. Please advice.

    I get a weekly text file 'email-week-061308.txt' that contain e-mail addresses. I refer this as file-a
    I have a master file 'email-hist.txt' with all accumulated e-mail address till date. I refer this as file-b

    I need to do the following
    (a)Sort and weedout duplicates from file-a and create file-c
    (b)Split file-c into small files of 100 records each with names file-c1, file-c2... thru file-cn
    (c)Merge file-c with file-b and weedout duplicates if any (from combined file-c)

    Thanks

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Here's a start.

    1) Create a new workbook, and in a general module enter the code

    Please Login or Register  to view this content.
    Save this workbook, and keep it as your main controlling workbook.

    2) Open your 2 text files (file-a and file-b in your post)
    3) Make sure that you are in the directory / path that you require for the output files (ie go file, open, change the path directory, then close without opening a file). This could be incorporated into the macro if required, or made the same place as the main controlling macro file.
    4) Run the code. This will create your small split files, and rework file-b to bring in the new entries. Note that file-b will not be automatically saved - this could be incorporated in the code when you are confident that it is actioning correctly.

    See how it goes.

    rylo

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523
    Quote Originally Posted by akondeti
    I get a weekly text file 'email-week-061308.txt' that contain e-mail addresses. I refer this as file-a
    I have a master file 'email-hist.txt' with all accumulated e-mail address till date. I refer this as file-b

    I need to do the following
    (a)Sort and weedout duplicates from file-a and create file-c
    (b)Split file-c into small files of 100 records each with names file-c1, file-c2... thru file-cn
    (c)Merge file-c with file-b and weedout duplicates if any (from combined file-c)

    Thanks
    Are all these files text files ?
    Do you just want to create unique list of email address out of these 2 files and create individual files for each email ?
    Please Login or Register  to view this content.

+ 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