for Ze = 2 to 59
if Cells(ze, 1).Value > MaxWert then MaxWert = Cells(Ze,1).Value
next
For Ze = 2 to 59
if Cells(ze,i).Value > ZweitMax And Cells(ze,1).Value <> MaxWert then ZweitMax = Cells(ze,i). _
Value
next
Gruß, Danielfor Ze = 2 to 59
if Cells(ze, 1).Value > MaxWert then MaxWert = Cells(Ze,1).Value
next
For Ze = 2 to 59
if Cells(ze,1).Value > ZweitMax And Cells(ze,1).Value <> MaxWert then ZweitMax = Cells(ze,1). _
Value
next
Gruß, Daniel
Option Explicit
Sub ZweitGr()
Dim arrW As Variant, lngZ As Long, dblM As Double, dblZ As Double
arrW = Application.Transpose( _
Cells(2, 1).Resize(Cells(Rows.Count, 1).End(xlUp).Row - 1))
For lngZ = 1 To UBound(arrW)
If dblM < arrW(lngZ) Then
dblM = arrW(lngZ)
Else
' für 2. < 1.
If dblZ < arrW(lngZ) And arrW(lngZ) < dblM Then dblZ = arrW(lngZ)
' für 2. <= 1.
' If dblZ < arrW(lngZ) And arrW(lngZ) <= dblM Then dblZ = arrW(lngZ)
End If
Next lngZ
MsgBox "1.: " & dblM & vbLf & "2.: " & dblZ
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-LintfortA | B | C | D | E | |
1 | 5 | ||||
2 | 888 | ||||
3 | 666 | ||||
4 | 555 | ||||
5 | 889 | ||||
6 | 133 | ||||
7 | 88 | Ergebnis: | 1. | 999 | |
8 | 55 | 2. | 777 | ||
9 | 777 | ||||
10 | 999 | ||||
11 | 13 | ||||
12 | 12 | ||||
13 | 12 |
Sub ZweitGr()
Dim arrW As Variant, lngZ As Long, dblM As Double, dblZ As Double
arrW = Application.Transpose( _
Cells(2, 1).Resize(Cells(Rows.Count, 1).End(xlUp).Row - 1))
For lngZ = 1 To UBound(arrW)
If dblM < arrW(lngZ) Then
dblZ = dblM
dblM = arrW(lngZ)
Else
' für 2. < 1.
If dblZ < arrW(lngZ) And arrW(lngZ) < dblM Then dblZ = arrW(lngZ)
' für 2. <= 1.
' If dblZ < arrW(lngZ) And arrW(lngZ) <= dblM Then dblZ = arrW(lngZ)
End If
Next lngZ
MsgBox "1.: " & dblM & vbLf & "2.: " & dblZ
End Sub
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort