Need help with MatchEntry on Combo box (Userforms)

Thomas

Active Member
Joined
May 3, 2002
Messages
366
Ok...I've searched the board looking for a similar quesiton on this issue, but cannot seem to find the answer, so here goes:

I have a user form that allows either the new entry or update of a user's information (Employee ID, phone number, e-mail, etc.; each into different designated text boxes). The way it is currently set up, the combo box references a named range; if the user begins to type in a known user's name, all of the rest of the information auto-fills into the text boxes. The problem is as such:

Say for example that user 'Joe Blow' is in the named range. If *any* portion of this name (in correct order) is typed into the combo box, the rest of the information will auto-fill (ex: oe.... or blo...), which is causing a problem. I need the auto fill to hapen only when a known user's name is typed in, starting with the first letter, not from anywhere within the name.

VBA code-wise, this is how I've handled it thus far:

Private Sub ComboBox1_Change()
UserChoice = UserForm7.ComboBox1.Value
With Worksheets("Users").Range("PE_Team")
Set c = .Find(UserChoice, LookIn:=xlValues)
If Not c Is Nothing Then
UserForm7.TextBox1.Value = c.Offset(0, 1).Value
UserForm7.TextBox2.Value = c.Offset(0, 2).Value
UserForm7.TextBox3.Value = c.Offset(0, 3).Value
UserForm7.TextBox4.Value = c.Offset(0, 4).Value
End If
' If not matched to known user, clear all entries:
If c Is Nothing Then
UserForm7.TextBox1.Cut
UserForm7.TextBox2.Cut
UserForm7.TextBox3.Cut
UserForm7.TextBox4.Cut
End If

End With

End Sub

///////
Can anyone help me with this one? I tried using ComboBox1_AfterUpdate as well, and this didn't seem to do the trick.

Much thanks in advance
~Thomas
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
There might be a prettier way, but how about placing a button on your form such as "New"?
or "Add"?
This button would set a boolean flag to exit your change event at the beginning of the procedure.

Tom
 
Upvote 0
That's a good idea, but the hope is to create something with as little possibility for error as possible. With the number of people that will be using this, if there is a possibility of error; I'm sure it will be inadvertently found. With no offence to my co-workers, I need this as 'idiot-proof' as possible :wink:

~Thomas
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top