|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
不同长度的长整型对速度的影响,如果先行转换String,则速度平均。- Sub test()
- Dim i As Long, j As Long, h As Long
- Dim N As Long, N1 As Long
- Dim t
- Dim d As New Dictionary
- Dim d1 As New Dictionary
- h = 1
- N = 11
- N1 = 11
- 'Set d = CreateObject("scripting.dictionary")
- 'Set d1 = CreateObject("scripting.dictionary")
- Do
- t = Timer
- N = (N * 10) - 9
- For i = N To N + 10000
- d(i) = ""
- Next i
- t = Timer - t
- d.RemoveAll
- Sheet1.Cells(h, 1) = t
-
- t = Timer
- N1 = (N1 * 10) - 9
- For i = N1 To N1 + 10000
- d1(CStr(i)) = ""
- Next i
- t = Timer - t
- d1.RemoveAll
- Sheet1.Cells(h, 2) = t
- h = h + 1
- Loop While h <= 8
- End Sub
复制代码 |
|