ich hab ne schleife geschrieben,
aber wenn in einem Feld nichts drin steht, dann schreibt er einfach ne 1 rein, wisst ihr wo da das Problem liegt?
Das Programm soll so funktionieren:wenn die Zelle C12 (cells(12, 3) kleeiner wie 15 ist und die Zelle i42 kleiner wie 1 ist, dann soll er in die Zelle i42 eine 1 schreiben usw. .
Hier habe ich mal die Codierung reingeschrieben.
Private Sub ersetzen_Click()
Dim i As Integer
For i = 42 To 79 Step 2
If Cells(12, 3).Value <= 15 = True Then
If Cells(i, 9).Value < 1 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 9).Value = 1
Cells(i, 8).Value = "<"
ElseIf Cells(i, 9).Value > 1 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 8).Value = ""
End If
ElseIf Cells(12, 3).Value <= 50 = True And Cells(12, 3).Value > 15 = True Then
If Cells(i, 9).Value < 0.3 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 9).Value = 0.3
Cells(i, 8).Value = "<"
ElseIf Cells(i, 9).Value > 0.3 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 8).Value = ""
End If
ElseIf Cells(12, 3).Value <= 150 = True And Cells(12, 3).Value > 50 = True Then
If Cells(i, 9).Value < 0.1 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 9).Value = 0.1
Cells(i, 8).Value = "<"
ElseIf Cells(i, 9).Value > 0.1 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 8).Value = ""
End If
ElseIf Cells(12, 3).Value > 150 = True Then
If Cells(i, 9).Value < 0.05 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 9).Value = 0.05
Cells(i, 8).Value = "<"
ElseIf Cells(i, 9).Value > 0.05 = True And Not (Cells(i, 9).Value = "") Then
Cells(i, 8).Value = ""
End If
End If
Next i
End Sub