Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer
Select Case KeyAscii
Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0
Case 45 And InStr(TextBox, "-") = 0
If TextBox.SelStart > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
OnlyNumericKeys = KeyAscii
End Function




