Option Explicit
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim s As String
With TextBox1
s = Mid(.Text, 1, .SelStart) & Chr(KeyAscii) & Mid(.Text, .SelStart + 1)
End With
If KeyAscii = 46 Then KeyAscii = 44
If InStr("0123456789,", Chr(KeyAscii)) = 0 Then KeyAscii = 0
If Not IsNumeric(s) Then KeyAscii = 0: Exit Sub
If InStr(s, ",") > 0 Then If Len(s) - InStr(s, ",") > 2 Then KeyAscii = 0
End Sub