ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Best structure to store a long list of strings? (https://www.excelbanter.com/excel-programming/314955-best-structure-store-long-list-strings.html)

Lazer[_14_]

Best structure to store a long list of strings?
 

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

--
Laze
-----------------------------------------------------------------------
Lazer's Profile: http://www.excelforum.com/member.php...nfo&userid=750
View this thread: http://www.excelforum.com/showthread.php?threadid=27296


keepITcool

Best structure to store a long list of strings?
 
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


Lazer wrote:


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?

Thanks!
Eliezer




Stephen Bullen[_4_]

Best structure to store a long list of strings?
 
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




All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com