Option
Explicit
Dim
chkit, ncol
As
Variant
Private
Sub
CommandButton1_Click()
If
Me
.TextBox1.BackColor = ncol
And
Me
.TextBox2.BackColor = ncol
Then
_
Me
.Label1.Caption =
"Ergebnis = "
& _
Format(Berechne(
Me
.TextBox1.Value,
Me
.TextBox2.Value),
"#"
)
End
Sub
Private
Sub
TextBox1_Exit(
ByVal
Cancel
As
MSForms.ReturnBoolean)
Me
.Label1.Caption =
"Ergebnis"
On
Error
Resume
Next
chkit =
CDbl
(
Me
.TextBox1.Value)
If
Err.Number = 13
Then
Me
.TextBox1.BackColor = 255
Else
Me
.TextBox1.BackColor = ncol
End
If
On
Error
GoTo
0
End
Sub
Private
Sub
TextBox2_Exit(
ByVal
Cancel
As
MSForms.ReturnBoolean)
Me
.Label1.Caption =
"Ergebnis"
On
Error
Resume
Next
chkit =
CDbl
(
Me
.TextBox2.Value)
If
Err.Number = 13
Then
Me
.TextBox2.BackColor = 255
Else
Me
.TextBox2.BackColor = ncol
End
If
On
Error
GoTo
0
End
Sub
Private
Sub
UserForm_Initialize()
ncol =
Me
.TextBox1.BackColor
Me
.TextBox1.SetFocus
End
Sub
Function
Berechne(sTextBox1
As
String
, sTextBox2
As
String
)
As
Double
MsgBox
"ich berechne"
End
Function