This will allow the entry of any number, including negatives. The newStr technique can be used in other situations to validate in the KeyPress event.
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim newStr As String
With TextBox1
newStr = Left(.Text, .SelStart) & Chr(KeyAscii) & Right(.Text, Len(.Text) - .SelStart - .SelLength)
If Not IsNumeric(newStr & "0") Then
KeyAscii = 0
End If
End With
End Sub
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Text = Val(Replace(TextBox1.Text, ",", vbNullString))
End Sub
The BeforeUpdate cleans up user entries like "1,1223.45". Used with the Format command, it allows you to force the entry into a particular format, even if the user enters a different format.