View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
DarnTootn DarnTootn is offline
external usenet poster
 
Posts: 19
Default 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?