Category Archives: VBA Input Box

Have Excel VBA Find A Value Based On A UserForm Entry

This post will show you how to find and filter your worksheet based
on the value in your text box.

Here is a short description of what we want to do:

Since we are using VBA, we can use ADO, and not the standard Find/Replace function
Excel provides.

The following example will allow the user to enter a name in the text box on the UserForm, and
find the value from the list of contacts on the worksheet.

Our select statement will cause VBA to seek out the desired row values.

In the following example, we are looking to populate the combo box with customers in “London”. So “London” gets typed in, and 6 rows get found by the code.
Only 4 are shown here because of the space issue, but 6 records are found according to the red label.

Here is the UserForm:

So basically here is the entire code:

First you click the “Search” button

The code filters the list by the entry and add the items to the combo box.

Watch how it’s done:

Let me know if you have any questions.

Use this form to send me a message:

I consent to having this website store my submitted information so they can respond to my inquiry. See our privacy policy to learn more how we use data.
 

Facebooktwittergoogle_plusredditpinterestlinkedinmail
READ MORE