Advertisement

09.11.2008 at 08:59AM PDT, ID: 23723477
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.1

VBA to upload csv file contents into Excel and check for duplicates

Asked by y2jk in Microsoft Excel Spreadsheet Software

Tags: , , , ,

Desperately seeking a piece of VBA to do the following (tried looking for the answer but don't understand VBA so not sure if any similar examples found on this site would do what I need).

On a weekly basis, 5 users ftp a CSV file to a central server directory. Each CSV file contains 6 columns of data, with the same column headings, and in the same order. I would like to create an Excel workbook to house the contents of these 5 csv files. On a weekly basis, I want to update the workbook with the contents of the latest 5 csv files, without duplicating data. I want to run a macro which does the following:

- Looks for 5 uniquely named csv files (doesn't need to error if it doesn't find them)
- Opens each file and loops through each row to check if COLs A, B, C, D, E & F on the csv file exactly match an existing row (cols A-F) in the spreadsheet
- If they match, update col G only with the current date
- If they don't match, append the row to the end of the spreadsheet, and add the (current) date to col G
- Do a save of the workbook (and delete the csv file as well if possible).

So, an example just to be clear:

MyWorkbook.xls looks for File1.csv, opens it and loops through all its rows. For each row that matches cols A-F already in MyWorkbook.xls, it simply updates col G with the current date, for data it doesn't already find, it adds the data as a new row to MyWorkbook.xls and puts the current date in col G. Loops through to the end of file, then closes File1.csv. Looks for File2.csv and repeats the above. Looks for File3.csv, doesn't find it (the user hasn't sent it this week), ignores it and goes on to look for File4.csv. After it has finished looking for (and processing) all 5 specified csv files, does a save of MyWorkbook.xls. If it could also delete each csv file once processed, that would be a bonus, but is not essential.

I'm sure it's easy, but haven't got a clue how to achieve it!! Could someone provide me with a suitable piece of VBA? Also, please include comments to help me understand what it's doing, so that I may (hopefully) be able to edit it in the future if needs be.Start Free Trial
[+][-]09.12.2008 at 07:57AM PDT, ID: 22460464

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: Microsoft, Excel, 2003, VBA, VBA
Sign Up Now!
Solution Provided By: irudyk
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.12.2008 at 08:29AM PDT, ID: 22460765

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 08:37AM PDT, ID: 22460857

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 09:07AM PDT, ID: 22461229

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 11:51AM PDT, ID: 22462772

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.16.2008 at 06:25AM PDT, ID: 22488098

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.16.2008 at 06:41AM PDT, ID: 22488248

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 01:15AM PDT, ID: 22518853

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628