GeorgeWhite
New Member
- Joined
- Apr 20, 2017
- Messages
- 27
Hi All,
I currently use this code to only allow users to type numbers into the text box on my userform, I need some help with how I can modify this so the users are also blocked from putting zeros at the beginning of there data?
Many thanks
I currently use this code to only allow users to type numbers into the text box on my userform, I need some help with how I can modify this so the users are also blocked from putting zeros at the beginning of there data?
Code:
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", vbInformation
.Value = vbNullString
End If
End With
End If
End Sub
Many thanks