View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey ....[_2_] Corey ....[_2_] is offline
external usenet poster
 
Posts: 45
Default Adding a Leter to a Numerical Value on Exit

Private Sub TextBox1_Change()
TextBox1.MaxLength = "4"
If IsNumeric(TextBox1) = True Then TextBox1 = UCase(TextBox1) Else TextBox1
= ""
End Sub

The above code i am using to ensure only a 4 digit numerical value is placed
in the textbox.
I actually want on EXIT only that value entered, but with a "A" before it.
Like A4587 etc.

I tried using :
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Textbox1.MaxLength="5"
Textbox1.value = "A"+Textbox1.value
End Sub

But it clears the Textbox value

Is there a way around this?