View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg[_20_] Greg[_20_] is offline
external usenet poster
 
Posts: 58
Default Please help with code?

How do I set up the text box. I currently am using the exit code and when i
leave a box when is empty it comes up with the invalid code message box. I
tried the key press code and it comes up with the invalide code in between
key presses.

What should I use?


Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim ans

On Error Resume Next
ans = Application.Match(TextBox3.Text, Range("c:c"), 0)

If Not IsError(ans) Then
TextBox1.Text = Application.Index(Range("a:a"), ans)
TextBox2.Text = Application.Index(Range("b:b"), ans)
TextBox4.Text = Application.Index(Range("a:a"), ans)
TextBox5.Text = Application.Index(Range("b:b"), ans)
TextBox6.Text = Application.Index(Range("C:C"), ans)
TextBox7.Text = Application.Index(Range("D:D"), ans)
TextBox8.Text = Application.Index(Range("E:E"), ans)
TextBox9.Text = Application.Index(Range("F:F"), ans)
TextBox10.Text = Application.Index(Range("G:G"), ans)
TextBox11.Text = Application.Index(Range("H:H"), ans)
TextBox12.Text = Application.Index(Range("I:I"), ans)
Else
MsgBox "NOT IN LIST"
End If
On Error GoTo 0
End Sub
Thanks in advance

Greg