P
Pierre via OfficeKB.com
Hi,
I have a txt_box in a userform called txt_staf1 where the user can put in a
number for example 2,5 or 25,8.
I have the following code with the txt_box
Private Sub txt_staf1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
OnlyNumbers
rekenen
End Sub
where 'rekenen' is a sub that makes the sheet recalculate.
I check if the input is a number using the sub OnlyNumbers:
Private Sub OnlyNumbers(ctl As Object)
With ctl
If Not IsNumeric(Left(.Value, 1)) And .Value <> vbNullString Then
MsgBox "Sorry, alleen getallen toegestaan", vbOKOnly, "De Pensioen
Adviseur"
.Value = vbNullString
.SetFocus
End If
End With
End Sub
When the user puts in a number i get the error message: compile error,
argument not optional
Does anybody know what is wrong ?
thanks,
Jean-Pierre
I have a txt_box in a userform called txt_staf1 where the user can put in a
number for example 2,5 or 25,8.
I have the following code with the txt_box
Private Sub txt_staf1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
OnlyNumbers
rekenen
End Sub
where 'rekenen' is a sub that makes the sheet recalculate.
I check if the input is a number using the sub OnlyNumbers:
Private Sub OnlyNumbers(ctl As Object)
With ctl
If Not IsNumeric(Left(.Value, 1)) And .Value <> vbNullString Then
MsgBox "Sorry, alleen getallen toegestaan", vbOKOnly, "De Pensioen
Adviseur"
.Value = vbNullString
.SetFocus
End If
End With
End Sub
When the user puts in a number i get the error message: compile error,
argument not optional
Does anybody know what is wrong ?
thanks,
Jean-Pierre