autofilter by selection

d-alan

Board Regular
Joined
Mar 26, 2002
Messages
119
I have a userform set-up to autofilter 22 colums of data, Shown in a listbox. There are five different criterias you can use to get the stated result. That all works fine.
What I want to be able to do is after sorting by certain criteria beable to select an entry in the listbox. (I use the second column in which I have a mm/dd/yy hh:mm:ss format set-up.) and print it to another worksheet.
Believe it or not this all works fine if I have not filtered the list at all. Once I filter the list using any of the five criteria, the filter results come back with all entries.
I am using this code to filter by after making the selection.
Selection.AutoFilter Field:=2, Criteria1:=raloku.ListBox1.Value
Any ideas would be appreciated.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Not sure what code you're otherwise using, but I suggest you select visible cells after the filter.
 
Upvote 0
Selecting the visible cells is ok.

If I stop the macro right after the autofilter, it shows all selections, it does not find a match.

But it finds the match if no other search criteria was used-

What am I missing.
 
Upvote 0
What was going wrong was that the listbox rowsource was linked to the hidden sheet after copying results.
When I would clear that sheet to accept the new filtered data it was deleting the value of the listbox.
This was not an issue until now because filter criteria was always being selected from multiple comboboxes.
I am sure this is not the correct way, but I got around it by setting up a label.visible=false to hold the listbox value before the clear event.
It now works.
This message was edited by d-alan on 2002-03-29 12:17
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

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