Hallo, ich habe einen Laufzeitfehler '13.
Kann mir jemand weiterhelfen?
Der Fehler tritt auf wenn ich zuerst den Wert in die TextBox2 eintrage und anschl. TextBox1.
Es funktioniert bei der richtigen Reihenfolge.
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim BMI As String
BMI = CSng(CDbl(TextBox1.Value) / CDbl(TextBox2.Value / 100) ^ 2)
' Klassifikation nach WHO
Select Case BMI
Case Is < 20
TextBox3.BackColor = &H8080FF
Label4.Caption = "Untergewicht"
Case 20 To 25
TextBox3.BackColor = &HFF00&
Label4.Caption = "Normalgewicht"
Case 25 To 30
TextBox3.BackColor = &HFF&
Label4.Caption = "Übergewicht"
Case 30 To 40
TextBox3.BackColor = &HC0&
Label4.Caption = "Adipositas"
Case Is > 40
TextBox3.BackColor = &HC0&
Label4.Caption = "massive Adipositas"
End Select
TextBox3.Value = Format(BMI, "0.0")
TextBox1.SetFocus
End Sub
|