Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Textbox accepts alpha only

hello there! i have this 3 textboxes then what i want to do is to
accept alpha only..because my textbox labeled as the name of a person.
thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Textbox accepts alpha only

use the textbox's key press to trap and test which key was pressed.
The code below will allow a space, a hyphen, uppercase and lowercase letter
only. Anything else, then keyascii is set to 0, so nothing gets added to the
text

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 32, 45, 65 To 90, 97 To 122
''do nothing, these are OK
Case Else
' clear the key, we don't want it
KeyAscii = 0
End Select
End Sub

"LeLi" wrote:

hello there! i have this 3 textboxes then what i want to do is to
accept alpha only..because my textbox labeled as the name of a person.
thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Textbox accepts alpha only

thanks Patrick!

Reply
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
How do I sort alpha neumeric fields that have an alpha suffix? Bob Sparks Excel Worksheet Functions 3 May 31st 09 05:17 AM
Function that accepts and returns a decimal, is it possible? LongBow Excel Worksheet Functions 0 August 30th 07 10:17 AM
The colums changed from alpha to numeric how do you make it alpha worldmade Excel Discussion (Misc queries) 2 May 26th 05 03:44 PM
TextBox that only accepts integers? Claud Balls Excel Programming 2 January 4th 05 10:57 PM
Sheet Name not accepts special characters Bhuktar S[_4_] Excel Programming 1 April 23rd 04 11:46 AM


All times are GMT +1. The time now is 10:39 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"