阅: 707 | 回: 0
等级:初学者
- 积分:0
- 财富值:1.9
- 身份:普通用户
以下是原语句,统计几百千来组问题不大,但统计上万上十万组时间就很长,请大佬帮忙优化一下,万分感谢!
Sub 统计()
Application.ScreenUpdating = FalseApplication.Calculation = xlCalculationManual
Dim i&, l&, n%, m%, j%, k%
For i = 0 To 100000006
[B8] = 0 + i
[A9] = 50 + n
[B9] = 50 + l
Cells([A9], 8) = m - 1
If Cells([A9], 1) = "" Then Application.ScreenUpdating = True: Exit Sub
k = 0
For j = 1 To 9
If WorksheetFunction.CountIf(Cells([A9], 1).Resize(1, 9), Cells([B9], j)) > 0 Then
k = k + 1
End If
Next j
If k > 5 Then
m = m + 1
End If
l = l + 1
If Cells([B9], 1) = "" Then
n = n + 1
m = 0
l = 0
End If
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
我的个性签名