samedi 25 janvier 2020

Problem with Visual Basic if and loop crash

like in the title, that code crashes my Excel and I don't know how I can fix it. If someone could help I would be grateful :)

Sub calculate()
Range("B2").Activate
Do While ActiveCell.Value <> ""
    If ActiveCell.Value + ActiveCell.Offset(0, 1) + ActiveCell.Offset(0, 2) = 3 Then
        ActiveCell.Offset(0, 3).Value = "Ocena pozytywna"
    ElseIf ActiveCell.Value + ActiveCell.Offset(0, 1) + ActiveCell.Offset(0, 2) = 2 Then
        ActiveCell.Offset(0, 3).Value = "Ocena pozytywna warunkowa"
    ElseIf ActiveCell.Value + ActiveCell.Offset(0, 1) + ActiveCell.Offset(0, 2) < 2 Then
        ActiveCell.Offset(0, 3).Value = "Ocena negatywna"
    End If
Loop
End Sub

Aucun commentaire:

Enregistrer un commentaire