LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check the content of a textbox?


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!


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=557880

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox control stops displaying linked cell content bda75 Excel Discussion (Misc queries) 0 January 24th 07 05:26 PM
Textbox Content Type KingG Excel Programming 4 May 12th 06 03:26 PM
Copy a cell content into a TextBox snaggy^^ Excel Programming 1 January 19th 06 10:40 PM
Verify the format of the content of a textbox included in a frame Edgar[_2_] Excel Programming 1 October 13th 05 12:15 AM
Excel VBA - Cursor disappears when validating content of a TextBox lonewolfbr Excel Programming 0 September 16th 04 09:49 PM


All times are GMT +1. The time now is 09:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"