Vertical
07-27-2010, 12:10 AM
Ok I have around 5,000 ID numbers in an excel file and need to see if they match any of the numbers in (currently 3) 3 different Excel files containing about 650 lines each. The files are setup basically the same with Column B containing the ID numbers I want to match to. Basically I'm trying to do this:
Procedural Code:
1. Open Master Excel File containing all of the numbers I want to try to match in the other 3 files. (Contains Variable set of numbers to match all in column A)
2. Open workbook1, see if Column B contains a match for first number in Master Excel File (Cell A1).
3. Open workbook2, see if Column B contains a match for first number in Master Excel File (Cell A1)
4. Open next workbook, etc etc.
5. If a match is found, In the master workbook next to the ID number, copy the Workbook name it was found in to Column B. In column C the macro should paste the CELL that the number was found in (As long as I have the line number). If multiple matches are found (in more than 1 workbook, it should see if Column B is blank, if not, it should insert a comma after the existing filename and insert the next found location).
The Master File should end up looking like this:
COLUMN A COLUMN B COLUMN C
10020301 Workbook1 B700
14242523 Workbook3,Workbook4 B234
23256232 Workbook1 B633
The number of workbooks im searching through may change. So i'd like it to be variable (based on a specific directory, rather than workbook names). Made to search through every workbook in a specific folder.
If anyone already has this code they are using (or anything very simular) please paste it. If anyone feels like helping me out with some code I would really appreciate it. I am at work right now, and I have to get these done as soon as possible as it may pertain to a product recall. (Im matching serial numbers for certain criteria) I am quite decent at programming when I have existing code to work with, but I'm least familiar with VB and I haven't used it in a few years. (Certainly not good at making it effecient).
Thanks for any help anyone can give me. This is a DAUNTING task to try to do without a macro. Will probably take me every night all night for the next couple of weeks to do without a macro to help. If I can make a macro, I can just type all of the serial numbers into the main excel file and have all of the data matches come up beside them then I can just type in the information that is needed only on the ones that match hopefully reducing the number of serials I have to enter data for. And also making it really easy to find the lines I need to enter the data at.
Procedural Code:
1. Open Master Excel File containing all of the numbers I want to try to match in the other 3 files. (Contains Variable set of numbers to match all in column A)
2. Open workbook1, see if Column B contains a match for first number in Master Excel File (Cell A1).
3. Open workbook2, see if Column B contains a match for first number in Master Excel File (Cell A1)
4. Open next workbook, etc etc.
5. If a match is found, In the master workbook next to the ID number, copy the Workbook name it was found in to Column B. In column C the macro should paste the CELL that the number was found in (As long as I have the line number). If multiple matches are found (in more than 1 workbook, it should see if Column B is blank, if not, it should insert a comma after the existing filename and insert the next found location).
The Master File should end up looking like this:
COLUMN A COLUMN B COLUMN C
10020301 Workbook1 B700
14242523 Workbook3,Workbook4 B234
23256232 Workbook1 B633
The number of workbooks im searching through may change. So i'd like it to be variable (based on a specific directory, rather than workbook names). Made to search through every workbook in a specific folder.
If anyone already has this code they are using (or anything very simular) please paste it. If anyone feels like helping me out with some code I would really appreciate it. I am at work right now, and I have to get these done as soon as possible as it may pertain to a product recall. (Im matching serial numbers for certain criteria) I am quite decent at programming when I have existing code to work with, but I'm least familiar with VB and I haven't used it in a few years. (Certainly not good at making it effecient).
Thanks for any help anyone can give me. This is a DAUNTING task to try to do without a macro. Will probably take me every night all night for the next couple of weeks to do without a macro to help. If I can make a macro, I can just type all of the serial numbers into the main excel file and have all of the data matches come up beside them then I can just type in the information that is needed only on the ones that match hopefully reducing the number of serials I have to enter data for. And also making it really easy to find the lines I need to enter the data at.