View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 1
Default Is this slow code?

Hi all,

Is my implementation the best way to do this?? My code works but it is very
very
slow - but my user base which will use the code are al on P2's as well!

I am trying to achieve the following:

I have a list of 30 items in a col in a spread sheet.
I have 1 other cell which are constants
I have a [5][1000] table on another sheet in the spready, of which I am
retreiving only values from 2 columns.

For each item in the 30 column list, I want to check all 1000 rows, to
determine if any of the rows match the item, and the 1 constant. If a match
is found then I'm done and I break out.


Am I doing something really ineffcicent?

any help

Thanks

Tom



'Set up the loop. This is a decrementing loop becuase we want to delete
items out of it _
with out effecting the index
'Note the list stops at 2 to ensure the Heading is not removed.
For listCount = listLoop To 2 Step -1
' set the delete condtion to true
DeleteLogic = True
' get the item at the bottom of the list
listValue = Sheet13.Range(listRange & listCount)

' Set up the second loop which will loop through the entire config
table this loop _
increments
For rConfigCount = 2 To rConfigLoop
' Perform the test: If the workstream and list values exsist in
a config row _
then do not delete
If Trim(listValue) < "" _
And _
rConfig.Cells(rConfigCount, configCheck1).Value = listValue _
And _
rConfig.Cells(rConfigCount, configCheck2).Value = userSelection
_
Then
' if a match is found then I don't want to delete
DeleteLogic = False
' if a match is found there is not point searching the rest
of the table.
Exit For
End If

Next rConfigCount
'Perform delete if necessary
If DeleteLogic = True Then _
Sheet13.Range(listRange & listCount).Delete xlShiftUp

Next listCount