| ElseIf |
| |
| |
| Aufgabe: Die Hintergrundfarbe eines Textfeldes soll bei einem Inhalt (Zahl) größer als 5 von weiß in grün, bei |
| mehr als 10 in blau, bei mehr als 100 in rot übergehen, wobei die Schriftgröße von 8 über 10 auf 12 nach 14 |
| zunehmen soll. |
| |
| |
| Private Sub txtInput_Change1() | Private Sub txtInput_Change2() |
| Dim zahl% | |
| With txtInput | With txtInput |
| zahl = Val(.Text) | |
| | |
| If zahl <= 5 Then | If Val(.Text) > 100 Then |
| .BackColor = RGB(255, 255, 255) | .BackColor = RGB(255, 0, 0) |
| .FontSize = 8 | .FontSize = 14 |
| End If | |
| | |
| If zahl > 5 And zahl <= 10 Then | ElseIf Val(.Text) > 10 Then |
| .BackColor = RGB(0, 255, 0) | .BackColor = RGB(0, 0, 255) |
| .FontSize = 10 | .FontSize = 12 |
| End If | |
| | |
| If zahl > 10 And zahl <= 100 Then | ElseIf Val(.Text) > 5 Then |
| .BackColor = RGB(0, 0, 255) | .BackColor = RGB(0, 255, 0) |
| .FontSize = 12 | .FontSize = 10 |
| End If | |
| | |
| If zahl > 100 Then | Else |
| .BackColor = RGB(255, 0, 0) | .BackColor = RGB(255, 255, 255) |
| .FontSize = 14 | .FontSize = 8 |
| End If | End If |
| End With | End With |
| End Sub | End Sub |
| |