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 |
Please help with code?
Can you be more specific as to what you are trying to do?
Bob "Greg" wrote in message ... 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 |
Please help with code?
If they have to enter something that matches column C in textbox3, why not just
make textbox3 a combobox? Greg wrote: 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 -- Dave Peterson |
All times are GMT +1. The time now is 12:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com