Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Restricting Characters within a User Form
How does one restrict certain characters from being entered into a user form
TextBox? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Restricting Characters within a User Form
Try some code like the following.
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim C As String With Me.TextBox1 If Len(.Text) = 0 Then Exit Sub End If C = Right(.Text, 1) Select Case C Case "a", "b", "c" ' allowed Case Else ' anything else is prohibited .Text = Left(.Text, Len(.Text) - 1) End Select End With End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 19 Nov 2008 13:00:05 -0800, DarnTootn wrote: How does one restrict certain characters from being entered into a user form TextBox? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Restricting Characters within a User Form
I think with a few "tweaks" to it, this will work perfectly. Thanks again!!
If it weren't for folks like yourself that contribute to these discussion groups I would never get anything done and would be spending my time in professional training courses to get the same kind of information that I get from this group. THANKS TO ALL !! "Chip Pearson" wrote: Try some code like the following. Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim C As String With Me.TextBox1 If Len(.Text) = 0 Then Exit Sub End If C = Right(.Text, 1) Select Case C Case "a", "b", "c" ' allowed Case Else ' anything else is prohibited .Text = Left(.Text, Len(.Text) - 1) End Select End With End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 19 Nov 2008 13:00:05 -0800, DarnTootn wrote: How does one restrict certain characters from being entered into a user form TextBox? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Restricting Characters within a User Form
Again, Thank you to all those that contribute to this disscussion group.
THIS ONE WORKS GREAT THANKS CHIP!!!!! "DarnTootn" wrote: I think with a few "tweaks" to it, this will work perfectly. Thanks again!! If it weren't for folks like yourself that contribute to these discussion groups I would never get anything done and would be spending my time in professional training courses to get the same kind of information that I get from this group. THANKS TO ALL !! "Chip Pearson" wrote: Try some code like the following. Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim C As String With Me.TextBox1 If Len(.Text) = 0 Then Exit Sub End If C = Right(.Text, 1) Select Case C Case "a", "b", "c" ' allowed Case Else ' anything else is prohibited .Text = Left(.Text, Len(.Text) - 1) End Select End With End Sub Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 19 Nov 2008 13:00:05 -0800, DarnTootn wrote: How does one restrict certain characters from being entered into a user form TextBox? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Restricting user to enter the date in a particular format only ! | Excel Discussion (Misc queries) | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
restricting use of certain characters | Excel Discussion (Misc queries) | |||
Restricting Multi-user access | Excel Worksheet Functions | |||
User Form Still Trying | New Users to Excel |