Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default textbox validation

hi!
i have a multipage within a form. the multipage has
several textboxes. some of them use the values of the
others textboxes to do math thing, like adds.
everything goes wrong when the user capture characters.
how can i ensure the user to capture only numbers, integer
numbers?
tia.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default textbox validation

Hi Begi,

Here is a textbox event that only allows numeric input

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57 'Nos 0 - 9
Exit Sub
Case 32 ' space
Case Else
Application.EnableEvents = False
KeyAscii = 0
Application.EnableEvents = True
Beep
End Select

End Sub

It also allows spaces, if you don't want that remove the line

Case 32 ' space

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Beginner" wrote in message
...
hi!
i have a multipage within a form. the multipage has
several textboxes. some of them use the values of the
others textboxes to do math thing, like adds.
everything goes wrong when the user capture characters.
how can i ensure the user to capture only numbers, integer
numbers?
tia.



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
Textbox validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 May 8th 09 11:15 PM
show the input message of a data validation list on a textbox and set editable HCS7 Excel Discussion (Misc queries) 3 November 20th 08 11:43 AM
putting validation to TextBox in the userform salihyil[_6_] Excel Programming 1 February 26th 04 12:10 PM
putting validation to TextBox in the userform salihyil[_8_] Excel Programming 1 February 26th 04 10:59 AM
Userform Textbox in Password Validation golf4 Excel Programming 3 July 28th 03 02:27 PM


All times are GMT +1. The time now is 07:29 AM.

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"