问题:我不得不在一张大表中搜索特定的保单编号。当有近 75,000 行时,查找功能需要相当长的时间。关于如何比较这两张 75,000 行的表格有什么建议吗?我认为可能可行的解决方案是对每张纸进行排序,然后获取需要找到的保单编号并将其与中间行进行比较。有没有办法比较该策略编号并查看在简单排序函数中它是否大于或小于?在找到那个比较之后,我会重置上限和下限并再次找到中间。......这会更快吗?还有其他建议吗?
谢谢
当前代码:
Sub policyComment()
Dim x As Integer
Dim endRow As Variant
Dim polSer As String
Dim foundVal As String
Dim commentVar As Variant
Windows("SuspenseNoteMacro.xlsm").Activate
Sheets("Main").Select
Range("A2").Select
endRow = ActiveCell.End(xlDown)
x = 2
Do
polSer = Range("A" + CStr(x)).Value
Windows("010713 Suspense ALL.xlsm").Activate
Sheets("Sheet1").Select
Set foundRange = Sheets("Sheet1").Cells.Find(what:=polSer, LookIn:=xlFormulas, lookat:=xlWhole)
'foundRange = ActiveCell.Value
If foundRange Is Nothing Then
Windows("SuspenseNoteMacro.xlsm").Activate
Sheets("Main").Select
Range("J" + CStr(x)).Value = "Not Found"
ElseIf foundRange <> "" Then
Sheets("Sheet1").Cells.Find(what:=polSer, LookIn:=xlFormulas, lookat:=xlWhole).Activate
commentVar = Range("J" + CStr(ActiveCell.Row)).Value
Windows("SuspenseNoteMacro.xlsm").Activate
Sheets("Main").Select
Range("J" + CStr(x)).Value = commentVar
End If
x = x + 1
Range("A" + CStr(x)).Select
foundRange = ""
Loop Until (x = endRow)
End Sub