Using an existing table in a VBA routine

Jagerdawg

New Member
Joined
Jun 20, 2002
Messages
9
I currently have a VBA routine I use to parse a text file which holds 5 million account numbers. I also have a table that lists individual account numbers that may be found in the text file. I would like to use this existing table as criteria selection when parsing the text file. I currently am using a case statement as a work around.

Thank you in advance... :pray:
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Not exactly sure if this is what you need, but if you're just looking to return the records from the text file that have a matching account number in your table, you can use a query with a subquery as it's criteria:
Code:
SELECT * FROM Your_Text_File WHERE [Account_Number] IN (SELECT [Account_Number] FROM Your_Account_Table)
 
Upvote 0
Thanks. However, I would like to test the account numbers verse the table while the parsing routine is running.

For example: The table contains account number "ABC".

As the parsing routine runs it compares each new line contains account number "ABC" in a specific location on the line.

"123" Skip
"ABC" Process
"@@@" Skip
 
Upvote 0
Are you trying to restrict data available to your code depending on values in the look-up table? You should be able to do that using SQL with criteria.

Peter
 
Upvote 0

Forum statistics

Threads
1,221,657
Messages
6,161,084
Members
451,684
Latest member
smllchng5

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top