VBA: Auto Filter listbox based on Textbox Value

Xlacs

Board Regular
Joined
Mar 31, 2021
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone,

I'm kinda new to this VBA and come across a problem with my project.
I'm seeking for some expert who can help me with this one.

So, i have a userform with listbox and a texbox that have a defualt value using Environ. Extracting the username.
In my excel sheet. I have a pivot listed employee name is with textbox and second column is their productivity numbers.
Whenever that user activate the userform, that textbox autofill it's value by their name.

What I wanted to achieved is whenever the textbox value match my pivot my list box will only filter the list with match the textbox.

I have attached Screenshot of my sheet.

VBA Code:
Listbox1.Rowsource = Daily!A1:B5000

This just extract the whole data. I wanted to show just the data of the employee of the name in the textbox.

Thank you guys!
 

Attachments

  • sheet.jpg
    sheet.jpg
    59.8 KB · Views: 10

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
There is a possibility that you change your data to something like the example below.
In this way it will be easier for you to work with your data, to filter, organize, group, take a table or a pivot table, for subtotals, formulas, even for macros, in short for everything. The way you have your data you will have difficulties for everything.


Dante Amor
ABC
1EmployeeDateProd
2Emp101-oct20
3Emp102-oct21
4Emp103-oct22
5Emp104-oct23
6Emp105-oct24
7Emp106-oct25
8Emp107-oct26
9Emp108-oct27
10Emp109-oct28
11Emp201-oct23
12Emp202-oct24
13Emp203-oct25
14Emp204-oct26
15Emp205-oct27
16Emp206-oct28
17Emp207-oct29
18Emp208-oct30
19Emp209-oct31
20Emp301-oct26
21Emp302-oct27
22Emp303-oct28
23Emp304-oct29
24Emp305-oct30
25Emp306-oct31
26Emp307-oct32
27Emp308-oct33
28Emp309-oct34
Hoja5
 
Upvote 0
There is a possibility that you change your data to something like the example below.
In this way it will be easier for you to work with your data, to filter, organize, group, take a table or a pivot table, for subtotals, formulas, even for macros, in short for everything. The way you have your data you will have difficulties for everything.


Dante Amor
ABC
1EmployeeDateProd
2Emp101-oct20
3Emp102-oct21
4Emp103-oct22
5Emp104-oct23
6Emp105-oct24
7Emp106-oct25
8Emp107-oct26
9Emp108-oct27
10Emp109-oct28
11Emp201-oct23
12Emp202-oct24
13Emp203-oct25
14Emp204-oct26
15Emp205-oct27
16Emp206-oct28
17Emp207-oct29
18Emp208-oct30
19Emp209-oct31
20Emp301-oct26
21Emp302-oct27
22Emp303-oct28
23Emp304-oct29
24Emp305-oct30
25Emp306-oct31
26Emp307-oct32
27Emp308-oct33
28Emp309-oct34
Hoja5

Hi!

Thank you for the suggestion.. That make sense.. However, I'm still not able to filter my listbox based on my textbox value.. 😔
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,122
Members
448,550
Latest member
CAT RG

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