Delete All Rows That Column A value is not in Column A of Sheet2
I have a large dataset that I'm pulling out of an Access database using a
query to extract the records I want (around 1000 records).
May second data set is a large Excel table that has around 10,000 rows.
I'd like to be able to delete all rows in the Excel table (call it
sht_Excel) that do not have a value in Column A that is listed in the list
from the query (call it sht_DB) .
What is the most efficient way to do this?
I came up with the foloowing approaches:
1) Sort both lists by Column A. Start with sht_DB.Range("A1").
If sht_Excel.Range("A1") doesn't equal it, delete the entire row.
If sht_Excel.Range("A1") equals it, check sht_Excel.Range("B1")
If sht_Excel.Range("B1") doesn't equal it, compare to sht_DB.Range("B1").
Continure in this fashion marching down through both lists.
2) Adding a Vlloukup function to the sht_Excel list, and delete the row if
it doesn;t returna match
There has to be a better way todo this than brute force.
Is it better to link the Excel Table to a dummy Acces database, and do a
query in it?
Any help would be appreciated.
|