Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello, I'm sure you have answered this a thousand times but I done little search and couldn't find what I was looking for. What I am after is a text box which does not allow letters to b entered into it. I have seen a few codes which check for letters afte the box has been filled but I want one where the user can press letter key and nothing happens in the box i.e it only responds t numbers. Any help would be greatly appreciated. Thanks Joh -- johncassel ----------------------------------------------------------------------- johncassell's Profile: http://www.excelforum.com/member.php...fo&userid=2501 View this thread: http://www.excelforum.com/showthread.php?threadid=39016 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Your tickets are the keypress event and the sendkeys method. Use some code like: Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Not (KeyAscii = 48 And KeyAscii <= 57) Then ' not a digit Range("B17").Value = KeyAscii SendKeys ("{BS}") 'send backspace End If End Sub What it does is sends a backspace character immediately after any non-digit character. -- TommySzalapski ------------------------------------------------------------------------ TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561 View this thread: http://www.excelforum.com/showthread...hreadid=390166 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks very much for that Tommy, precisely what I was after and thank for replying so fast -- johncassel ----------------------------------------------------------------------- johncassell's Profile: http://www.excelforum.com/member.php...fo&userid=2501 View this thread: http://www.excelforum.com/showthread.php?threadid=39016 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Custom Formating Letters to Numbers while Displaying Letters | Excel Worksheet Functions | |||
Columns now numbers rather than letters how do i get letters back | Excel Discussion (Misc queries) | |||
Count only Letters in cells that contain both letters and numbers | Excel Worksheet Functions | |||
Sorting - cells containing numbers, numbers and letters | Excel Discussion (Misc queries) | |||
create self-generating numbers with letters and numbers | Excel Discussion (Misc queries) |