小班编号2

Sub xyf()

 

Dim arr As New Collection
Dim lindi_arr As New Collection
maxnban = 0
maxban = 0
i = 1
Do While Cells(i, 1).Value <> ""
arr.Add Cells(i, 1).Value
If arr(i) < 8000 Then
lindi_arr.Add Cells(i, 1).Value
End If
If maxnban < arr(i) Then
maxnban = arr(i)
End If
i = i + 1
Loop

For i = 1 To lindi_arr.Count Step 1
If maxban < lindi_arr(i) Then
maxban = lindi_arr(i)
End If
Next
arrconut = arr.Count


Cells(1, 2).Value = arr(1)

For i = 1 To arrconut Step 1
If i = arrconut Then
Exit For
End If
fban = arr(i)
sban = arr(i + 1)
If fban <> sban Then
Cells(i + 1, 2).Value = sban
End If
If fban = sban Then
If fban >= 8000 Then
maxnban = maxnban + 1
Cells(i + 1, 2).Value = maxnban
Else
maxban = maxban + 1
Cells(i + 1, 2).Value = maxban
End If
End If
Next

End Sub

posted on 2018-01-27 22:26  猪猪一号  阅读(169)  评论(0编辑  收藏  举报

导航