kann mir bei der Berechnung eines Wertepaares wer helfen?
https://www.herber.de/bbs/user/103280.xlsm
Gruß
Sub Wertepaare()
On Error GoTo Fehler
Dim TB1, TB2, i%, z%, Wmax, Gmax
Application.ScreenUpdating = False
'*** Stammdaten Anfang
Set TB1 = Sheets("Tabelle1")
Set TB2 = Sheets("Tabelle2")
z = 2
Gmax = -999999
With TB2
.Cells.ClearContents
.Cells(1, 1) = "Wert": .Cells(1, 2) = "Ergegnis"
For i = TB1.Range("B3") To TB1.Range("B4")
TB1.Cells(1, 2) = i
.Cells(z, 1) = i
.Cells(z, 2) = TB1.Cells(2, 2)
If TB1.Cells(2, 2) > Gmax Then
Gmax = TB1.Cells(2, 2)
Wmax = TB1.Cells(1, 2)
End If
z = z + 1
Next
TB1.Cells(1, 2) = Wmax
End With
'*** Fehlerbehandlung
Err.Clear
Fehler:
If Err.Number 0 Then MsgBox "Fehler: " & Err.Number & vbLf & Err.Description: Err.Clear
End Sub
Gruß UweD