Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForm textbox code
I thought I posted this question last Friday. But, I can't find it.
Maybe I didn't actually finish posting it..... I have deigned a UserForm that will allow the user to enter some info that will be copied to a worksheet when the user clicks the OK button. There are about a dozen fields the user will enter info to. I have code that will look at the textbox1 entry, and compare it with the data already in column J of this list, and warn the user if this data already exists.. This works fine, except that I would like it to identify this duplicate as soon as the user tabs out of textbox1. Right now, it will perform this check only after the OK button is clicked, when the whole UserForm is completed. I'd like to save the user from entering in all the data that will not be copied to the list anyway. Here is the current code to perform the check to find a duplicate when it compares the textbox1 entry vs entries in column J of the worksheet: With Worksheets("Official list") If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then MsgBox "This PO/PL is already on the list. Please edit the existing record " TextBox1.Text = Clear Else Range("J65536").End(xlUp)(2).Select Application.Selection.Value = TextBox1.Text End If End With Thanks for your help/suggestions. J.O. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForm textbox code
Hi,
Add this to the Uerform code: Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) With Worksheets("Official list") If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then MsgBox "This PO/PL is already on the list. Please edit the existing Record """ TextBox1.Text = Clear Else Range("J65536").End(xlUp)(2).Select Application.Selection.Value = TextBox1.Text End If End With End Sub HTH "excelnut1954" wrote: I thought I posted this question last Friday. But, I can't find it. Maybe I didn't actually finish posting it..... I have deigned a UserForm that will allow the user to enter some info that will be copied to a worksheet when the user clicks the OK button. There are about a dozen fields the user will enter info to. I have code that will look at the textbox1 entry, and compare it with the data already in column J of this list, and warn the user if this data already exists.. This works fine, except that I would like it to identify this duplicate as soon as the user tabs out of textbox1. Right now, it will perform this check only after the OK button is clicked, when the whole UserForm is completed. I'd like to save the user from entering in all the data that will not be copied to the list anyway. Here is the current code to perform the check to find a duplicate when it compares the textbox1 entry vs entries in column J of the worksheet: With Worksheets("Official list") If Application.CountIf(.Range("j:j"), TextBox1.Text) 0 Then MsgBox "This PO/PL is already on the list. Please edit the existing record " TextBox1.Text = Clear Else Range("J65536").End(xlUp)(2).Select Application.Selection.Value = TextBox1.Text End If End With Thanks for your help/suggestions. J.O. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForm textbox code
Thanks Toppers
I have a different twist of this problem. The problem you responded to, I figured out. I had the coding in the wrong sub. I thought I removed the post before anyone would respond to it. HOWEVER If you read my new entry I just entered, maybe you can help with this problem. Thanks, J.O. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with UserForm textbox code
Please see the new post Coding questions about UserForm TextBox.
I have this one all screwed up... Thanks, J.O. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TEXTBOX in USERFORM | Excel Programming | |||
userform textbox | Excel Worksheet Functions | |||
Adding TextBox to UserForm via code | Excel Programming | |||
Textbox in userform | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |