Best structure to store a long list of strings?

  • Thread starter Thread starter Lazer
  • Start date Start date
L

Lazer

I need to iterate through all the cells of a worksheet and delete al
rows that contain any words in a specific list. This "keyword" list i
quite long. What's the best way to store these words - keeping in min
both ease of adding more and ease of iteration, as well?

Thanks!
Elieze
 
try like:

strings in in a range or array

for each rCell in rSeach.Columns(1).Cells
if iserror(application.match(rCell,rStrings,0)) then
'unfound
endif
next



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Hi Lazer,
I need to iterate through all the cells of a worksheet and delete all
rows that contain any words in a specific list. This "keyword" list is
quite long. What's the best way to store these words - keeping in mind
both ease of adding more and ease of iteration, as well?

I would use a Dictionary object from the Windows scripting runtime for
the keyword list, mainly because it has an Exists property to test if an
item is in the list.

However, it might be more efficient to iterate through the list and use
Range.Find to see if they're used, rather than iterate through the cells
to see if they're in the list. It'll probably depend on the relative
size of the sheet and the lists.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top