|
Option Explicit
Sub 回弹值计算()
Dim i As Long, a As Long, b As Long, c As Long, mxa As Long, _
mxa1 As Long, mxa2 As Long, min As Long, min1 As Long, min2 As Long, _
count As Long, sum As Long
For i = 2 To 2
count = 0
sum = 0
mxa = -1
min = 101
For a = 2 To 17
If Cells(i, a) > mxa And Len(mxa) = 0 Then
mxa = Cells(i, a)
ElseIf Cells(i, a) > mxa And Len(mxa) Then
mxa1 = mxa: mxa = Cells(i, a)
ElseIf (Cells(i, a) > mxa1 And Cells(i, a) < mxa) And Len(mxa1) = 0 Then
mxa1 = Cells(i, a)
ElseIf (Cells(i, a) > mxa1 And Cells(i, a) < mxa) And Len(mxa1) Then
mxa2 = mxa1: mxa1 = Cells(i, a)
ElseIf Cells(i, a) > mxa2 And Cells(i, a) < mxa1 Then
mxa2 = Cells(i, a)
End If
count = count + 1
sum = sum + Cells(i, a)
Next a
Next i
MsgBox mxa2
End Sub |
|