ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofiltering (https://www.excelbanter.com/excel-programming/335816-autofiltering.html)

musictech[_4_]

Autofiltering
 

I am trying to filter the contents of a listbox, how can I do that?

[code]Private Sub categorybx_Click()
If categorybx.Value = "Cable" Then
categorybx.AutoFilter Criteria1:="Cable"
If categorybx.Value = "Fiber" Then
categorybx.AutoFilter Criteria1:="Fiber"
If categorybx.Value = "Faceplate" Then
categorybx.AutoFilter Criteria1:="Faceplate"
If categorybx.Value = "Jack" Then
categorybx.AutoFilter Criteria1:="Jack"
If categorybx.Value = "Connector/Coupler" Then
categorybx.AutoFilter Criteria1:="Connector/Coupler"
If categorybx.Value = "Patch Cable" Then
categorybx.AutoFilter Criteria1:="Patch Cable"
If categorybx.Value = "Hardware" Then
categorybx.AutoFilter Criteria1:="Hardware"
If categorybx.Value = "Termination" Then
categorybx.AutoFilter Criteria1:="Termination"
If categorybx.Value = "Electronics" Then
categorybx.AutoFilter Criteria1:="Electronics"
End Su
-------------------

--
musictec
-----------------------------------------------------------------------
musictech's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2485
View this thread: http://www.excelforum.com/showthread.php?threadid=39106


Mike Fogleman

Autofiltering
 
I am not sure what your goal is here. It sounds like you want to present a
list of choices, and when the user selects one, leave only the selected item
in the listbox. To do that make sure the ListBox has a LinkedCell somewhere
on the worksheet. Then put this code in your ListBox_Click ().

Private Sub categorybx_Click()
categorybx.Enabled = False
categorybx.ListFillRange = categorybx.LinkedCell
categorybx.Enabled = True
End Sub

This tells the listbox to display a different list, the item chosen from the
original list.
If this is not what you intended, then post back.
Mike F


"musictech" wrote
in message ...

I am trying to filter the contents of a listbox, how can I do that?

[code]Private Sub categorybx_Click()
If categorybx.Value = "Cable" Then
categorybx.AutoFilter Criteria1:="Cable"
If categorybx.Value = "Fiber" Then
categorybx.AutoFilter Criteria1:="Fiber"
If categorybx.Value = "Faceplate" Then
categorybx.AutoFilter Criteria1:="Faceplate"
If categorybx.Value = "Jack" Then
categorybx.AutoFilter Criteria1:="Jack"
If categorybx.Value = "Connector/Coupler" Then
categorybx.AutoFilter Criteria1:="Connector/Coupler"
If categorybx.Value = "Patch Cable" Then
categorybx.AutoFilter Criteria1:="Patch Cable"
If categorybx.Value = "Hardware" Then
categorybx.AutoFilter Criteria1:="Hardware"
If categorybx.Value = "Termination" Then
categorybx.AutoFilter Criteria1:="Termination"
If categorybx.Value = "Electronics" Then
categorybx.AutoFilter Criteria1:="Electronics"
End Sub
--------------------


--
musictech
------------------------------------------------------------------------
musictech's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=24851
View this thread: http://www.excelforum.com/showthread.php?threadid=391066




musictech[_5_]

Autofiltering
 

Mike,

What I have is a list of parts. They are represented in 3 columns.
The first column is the Category. So I will have only a few categorie
but several items that fall under those categories. Next column i
subcategory and the final is a description (or the specific part).
What I have created is a userform with 3 listboxes, and a button calle
insert. My goal is to have the contents of each column listed in th
each listbox. When I select an item from any listbox, I would like i
to filter the other boxes. Normally of course they would start fro
the left at the category box and move to the right. And the categor
box is the only one I would like not to be filtered. I would like i
to always show every category, so you can easily jump into anothe
category.

The insert button is going to be a different story. I am using thi
spreadsheet as a master list, and will not be the spreadsheet I will b
dealing with. So the insert button will be used to copy the selecte
data from the userform into another spreadsheet based on the cell
select to be the starting point. So basically the end user opens
new parts order spreadsheet, selects the first cell in the row the
want to start on, then clicks on a button at the top and start
selecting parts. As he/she hits insert, the parts they select ar
copied into the order in the next available row after the row the
selected.

I hope that clears up things and thanks for your hel

--
musictec
-----------------------------------------------------------------------
musictech's Profile: http://www.excelforum.com/member.php...fo&userid=2485
View this thread: http://www.excelforum.com/showthread.php?threadid=39106


musictech[_6_]

Autofiltering
 

still trying to solve this problem


--
musictech
------------------------------------------------------------------------
musictech's Profile: http://www.excelforum.com/member.php...o&userid=24851
View this thread: http://www.excelforum.com/showthread...hreadid=391066



All times are GMT +1. The time now is 03:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com