補充:
開新的工作簿
插入模組
以下模組自動填入一到一百萬
Sub test()
For i = 1 To 1000000
Sheets("工作表1").Cells(i, 1) = i + 1
Next
End Sub
查找方法一:直接使用內建函教,需時一秒
Sub find1()
t = Timer
If Sheets("工作表1").Range("a:a").Find(what:="987267", LookIn:=xlValues).Rows > 0 Then
MsgBox Timer - t
End If
End Sub
方法二:迴圈填入陣列,天哪,須時十一秒
Sub find2()
ReDim s(1 To 1000000)
t = Timer
For i = 1 To 1000000
s(i) = Sheets("工作表1").Cells(i, 1)
If s(i) = "987267" Then
MsgBox Timer - t
End If
Next
End Sub