List Box

dalinnus

New Member
Joined
Aug 19, 2007
Messages
22
Thanks to Mr. Excel's book "VBA and Macros for Microsoft Excel" I have been able to: Create a form to browse to a file, import the file. Then using the advanced filter I can create a unique list based on one of my columns and create a list box based upon this unique list. The very LAST piece that I am stumped on is how do I now filter the data based upon the Items the user had selected in the list box?

HELP!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to the Board!

You can record Filtering you range, then substitute the List Box's value for the criteria. I.E.

Code:
ActiveSheet.Range("$A$1:$B$8").AutoFilter Field:=1, Criteria1:=ListBox1.Value

Hope that helps,

Smitty
 
Upvote 0
I am sorry I do not understand. I am using a multi-select list box and it is my understanding that you cannot use the autofilter with the items selected by the multi-select list box--What I need to do is filter the data in the worksheet, specifically the column that I used to created the list box with and use the items that the user selected in the multi-select list box for the filter.

If I were to use the code above, would I put it on my 'OK" button that the user clicks when he is finished selecting the items in the list box??
 
Upvote 0
Just copy it from the VBE and post it in a new repy.

Then highlight it and click the Code button above the text entry.

Or just paste it in and I'll add the tags for you.

Smitty
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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