L
leonidas
Hi,
I have the following macro in excel vbe:
Code:
--------------------
Private Sub TextBox2_Change()
Dim okstop As Boolean
Dim mytext As String
okstop = False
Do
mytext = TextBox2.Value
If Not IsNumeric(mytext) And mytext <> "" Then
TextBox2.Value = ""
MsgBox ("Gebruik a.u.b. alleen nummers")
Else
okstop = True
End If
Loop Until (okstop = True)
End Sub
--------------------
This macro works fine and checks every number that is typed in the
textbox. But I tried to change it to a check for text only. The macro
is below:
Code:
--------------------
Private Sub TextBox3_Change()
Dim okstop As Boolean
Dim mytext As String
okstop = False
Do
mytext = TextBox3.Value
If IsNumeric(mytext) And mytext <> "" Then
TextBox3.Value = ""
MsgBox ("Gebruik a.u.b. alleen letters")
Else
okstop = True
End If
Loop Until (okstop = True)
End Sub
--------------------
The only problem is it only checks the first letter and then it quits
and you can enter numbers in it. What's wrong with the macro above and
how should it be changed to check every letter that is typed in the
textbox.
Thanks in advance for helping me!
I have the following macro in excel vbe:
Code:
--------------------
Private Sub TextBox2_Change()
Dim okstop As Boolean
Dim mytext As String
okstop = False
Do
mytext = TextBox2.Value
If Not IsNumeric(mytext) And mytext <> "" Then
TextBox2.Value = ""
MsgBox ("Gebruik a.u.b. alleen nummers")
Else
okstop = True
End If
Loop Until (okstop = True)
End Sub
--------------------
This macro works fine and checks every number that is typed in the
textbox. But I tried to change it to a check for text only. The macro
is below:
Code:
--------------------
Private Sub TextBox3_Change()
Dim okstop As Boolean
Dim mytext As String
okstop = False
Do
mytext = TextBox3.Value
If IsNumeric(mytext) And mytext <> "" Then
TextBox3.Value = ""
MsgBox ("Gebruik a.u.b. alleen letters")
Else
okstop = True
End If
Loop Until (okstop = True)
End Sub
--------------------
The only problem is it only checks the first letter and then it quits
and you can enter numbers in it. What's wrong with the macro above and
how should it be changed to check every letter that is typed in the
textbox.
Thanks in advance for helping me!