如何在有大量记录的webtable中查找指定的值

iStart = 1

iEnd = ...WebTable().RowCount

Do While iStart < iEnd

 iMiddle = (iStart + iEnd) \ 2

 value = WebTable.GetCellData(1, iMiddle)

 iCompare = StrComp(value, strFind)

 If iCompare = 0 then

  'Exact match has been found

  Msgbox "Value found at - " & iMiddle

  Exit Do

 ElseIf iCompare = 1 then

  'Value is greater than strFind

  iEnd = iMiddle - 1

 Else

 ' Value is less than strFind

  iStart = iMiddle + 1

 End If

Loop

 

posted @ 2012-07-21 10:18  dushuai  阅读(148)  评论(0编辑  收藏  举报