+ Reply to Thread
Results 1 to 10 of 10

Macro to select multiple file from local disk and do a match case and copy next 3 columns

  1. #1
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Macro to select multiple file from local disk and do a match case and copy next 3 columns

    Hi Guys,

    I am new to this forum and this is my first post.

    I have a requirement to develop a macro which should let me select multiple CSV files from my local drive and perform a match case on a particular column (say column AB) using the data on the macro file and if it's a match copy the next three column data from macro file to the selected CSV file.

    Example:

    Macro file: Sheet1 in workbook will have a command button which on click lets you select a CSV file. Sheet2 in the workbook will have the data as below.


    Andy age23 football 3
    Tommy age34 baseball 5
    Rick age27 Actor 2
    Sam age30 singer 6

    CSV file: This file will have the names in column say AB, the macro file should do a match case similar to vlookup and if it finds a match move the next three column from the macro sheet2 to csv file on AC,AD and AE respectively.


    Looking forward for your advice.

    Regards,
    Sinser

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Do you have sample file(s) that you can upload?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    No i don't have the sample file with me now.. Let me know if you have any specific question..

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    It will be good if you provide a sample file so we can work it out for you. It will help in testing too.

  5. #5
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Hi,

    I have attaced the sample file.

    Regards,
    Sinser
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Hi Arlette,

    I got to the part where i can open multiple sheet, but i am clueless after this. Please help

    Regards,
    Sinser

  7. #7
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Uploaded samplefile

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Your sample file does not match your question. In other words, you said we have to compare based on column AB, but your csv file has only 7 columns and your master file has 6. Please specify clearly what needs to be done. I can give you the code as per the sample and then you can modify it for your original file.
    Or you can submit the sample files in the same format as your original files so that you do not have to make any alterations from your side.

  9. #9
    Registered User
    Join Date
    05-25-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    Hi Arlette,

    You can give me the code as per the attached sample file, the original is too big and has some sensitive data which i cannot upload on internet.

    Regards,
    SINSER

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to select multiple file from local disk and do a match case and copy next 3 col

    The fields in Test.csv do not match the Data library. Can you specify which field goes where, so i can work it out for you?

+ 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