Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ooh, I'm glad you pointed that out.
I'll use both validation and this method, then. Thanks for the warning, Darren Dave Peterson wrote: Well, maybe... You notice that I wrote: "This'll stop the typing of those characters:" It doesn't stop the user from pasting anything into that textbox. Darren Hill wrote: Ah, excellent. So it is possible to stop the entry of illegal characters. Thanks, Dave. Darren Dave Peterson wrote: This'll stop the typing of those characters: Option Explicit Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii 'numbers, letters, commas, spaces, apostrophes, and full stops Case Asc("0") To Asc("9"), Asc("a") To Asc("z"), Asc("A") To Asc("Z"), _ Asc(","), Asc(" "), Asc("'"), Asc(".") 'ok Case Else KeyAscii = 0 Beep End Select End Sub Darren Hill wrote: I have a textbox or two that I want to run some validation on. Basically, I only want to allow numbers, or uppercase or lowercase letters, or commas, spaces, apostrophes, and full stops. (, '.) What code would I need to restrict entry to these possibilities? Or failing that, after they have been entered, to validate against them to report an error. Thanks, Darren |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
convert 5 characters in a cell to 6 characters by adding a zero | Excel Discussion (Misc queries) | |||
how to check first 5 characters of a cell & then sum | Excel Worksheet Functions | |||
easy way to check for forbidden characters? | Excel Programming | |||
In Excel find characters when multiple characters exist w/i a cel | Excel Worksheet Functions | |||
Check for Alpha characters | Excel Discussion (Misc queries) |