Filter ListBox on a UserForm using a ComboBox

Jorge24

New Member
Joined
Oct 2, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi, I created a UserForm to enter data into a worksheet. In that UserForm I have a button that opens a ListBox showing all the records stored in the worksheet. I want to filter this ListBox using a ComboBox based on my "Area" column. I populated the ComboBox using unique values from the column. When I try selecting an area, I get an error on the code. Below you will see screenshots of my userforms and my code. If somebody knows how to fix this, please let me know

Screenshot 2024-10-02 100847.png

This is the main userform to enter data. If you click "Open Records" button, it will display ListBox in belows screenshot
Screenshot 2024-10-02 100915.png

Here, it shows all the records stored in my worksheet. I want to use the ComboBox above to filter these records by the area.
Screenshot 2024-10-02 100940.png

When I select an area in gives me this error message
Screenshot 2024-10-02 101014.png

Below is the code that I have to populate the ComboBox and the code to try filtering the ListBox
Screenshot 2024-10-02 101059.png
Screenshot 2024-10-02 101037.png
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi and welcome to MrExcel.

In this case, the loop must start at a number, and you have it with "i".
1727884781347.png


I don't know which column your data starts in, because you have an offset then - 2. Change the "i" to 3 and try.
For example:
VBA Code:
For i = 3 to 14


🤗
 
Upvote 0

Forum statistics

Threads
1,223,877
Messages
6,175,138
Members
452,614
Latest member
MRSWIN2709

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