You need to pass two parmameters first one is "keyascii" and second is textbox name
VB Code:
Public Sub OnlyNumeric(ByRef KeyAscii As Integer, Txt As TextBox)
Select Case KeyAscii
Case 48 To 57
IntPosition = InStr(1, Txt.Text, ".")
If IntPosition > 0 Then
If Len(Txt.Text) - InStr(1, Txt, ".") = 4 Then
KeyAscii = 0
Else
KeyAscii = KeyAscii
End If
End If
Case 8
Case 46
If InStr(1, Txt, ".") Then
KeyAscii = 0
Else
KeyAscii = KeyAscii
End If
Case 45
If InStr(1, Txt.Text, "-") Then
KeyAscii = KeyAscii
Else
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
End Sub