to enter possite or negitive number only
to enter possite or negitive number only
Rate to enter possite or negitive number only
(2(2 Vote))
KeyAscii = NumberValue(KeyAscii, CStr(Msk_ritty_comm), Val(Msk_ritty_comm.SelStart))
End Sub
Public Function NumberValue(ByVal Num As Double, ByVal str As Variant, ByVal CursPos As Integer)
If Num <= 42 And Num >= 58 Then
Num = 0
Else
Select Case Num
Case 48 To 58
Case 8
Case 46 '.
If InStr(1, str, ".", vbTextCompare) Then
Num = 0
End If
Case 45 '-
' If Len(str) > 1 Then
' Num = 0
' Else
'
' If InStr(1, str, "-", vbTextCompare) Then
' Num = 0
' End If
If Len(str) > 1 And InStr(1, str, "-", vbTextCompare) Then
Num = 0
Else
If Val(str) > 0 And CursPos > 0 Then
Num = 0
End If
If InStr(1, str, "-", vbTextCompare) Then
Num = 0
End If
End If
Case 47 ' /
Num = 0
Case 42 ' *
Num = 0
Case 43 ' +
Num = 0
Case Else
Num = 0
End Select
End If
NumberValue = Num
End Function
to enter possite or negitive number only Comments
No comments yet — be the first to post one!
Post a Comment