-
Solved: only numbers
hello
I found this code on net but in my case it is not working. this will not aloud to insert letters in an text box
with F8 I saw that on condition if :
[vba]If TypeName(Me.ActiveControl) = "TextBox" Then[/vba] go directly to end, End if ..so what it is wrong?
[vba]
Private Sub TextBox11_Change()
OnlyNumbers
End Sub
Private Sub OnlyNumbers()
If TypeName(Me.ActiveControl) = "TextBox" Then
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value <> vbNullString Then
MsgBox "Sorry, only numbers allowed"
.Value = vbNullString
End If
End With
End If
End Sub
[/vba]
thx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules