Efficient way to check if numbers are in an array/dictionary.

eddvrs

Board Regular
Joined
Jul 9, 2007
Messages
88
Hey,

I have a macro that loops thorugh a list of supplier codes on a worksheet and checks each one to see if that number appears in a text file. The text file represents a subset of supplier codes based on location, and as such is frequently updated.

Currently, I'm importing the data from the text file into a dictionary and checking each cell in a column to see if it appears in that dictionary using CO_Dictionary.Exists(activecell.formula)

My code then deletes the whole row if the code in the cell is not found in that dictionary.

This is taking ages as I often have to check about 100,000 rows. Is there a more efficient way for me to do this?

Cheers
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,326
Messages
6,124,267
Members
449,149
Latest member
mwdbActuary

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