Choice in Dropdown 1 creates choices in Dropdown 2.

M

Mr B

Howdy,

Trying agian to get an answer on how to do this. I've seen the tutorial about having each category
in it's own list but this doesn't work for me. Here's the setup.

I have data in a bunch of columns (like an access database view).
The columns are Item_Tag, Item_Type, Item_ID, Item_Model

I want to have Dropdown1 be a list of all the different values under Item_Type. Ideally if I could
just code it to go through the lsit and pul out unique values and put them in the dropdown that'd be
great. However for now I have a macro that goes through and pulls out the unique items through data
validation and then have the dropdown populate from there. This works fine.

However, what I want to happen is whatever item is chosen from the Item_Type dropdown, I then need
some code to run through the list of items and any item that has the same Item_Type, it should take
their Item_Tag and put it in another list to go in the second dropdown. How do I do this?

I cannot set up the data so there is a column for each category like in the tutorial I've eben given
a few times because there are other fields going with it. Is there any way to do this?

The step that would happen after the Item_Tag is selected is it would need to go get the rest of the
data on that row (Model, ID, etc) and put those in some other Cells as well.

Hope that makes sense.

Thanks!
 
D

Don Guillett

Have a look here
http://www.contextures.com/tiptech.html

--
Don Guillett
SalesAid Software
(e-mail address removed)
Mr B said:
Howdy,

Trying agian to get an answer on how to do this. I've seen the tutorial about having each category
in it's own list but this doesn't work for me. Here's the setup.

I have data in a bunch of columns (like an access database view).
The columns are Item_Tag, Item_Type, Item_ID, Item_Model

I want to have Dropdown1 be a list of all the different values under Item_Type. Ideally if I could
just code it to go through the lsit and pul out unique values and put them in the dropdown that'd be
great. However for now I have a macro that goes through and pulls out the unique items through data
validation and then have the dropdown populate from there. This works fine.

However, what I want to happen is whatever item is chosen from the
Item_Type dropdown, I then need
 
T

Tom Ogilvy

You can use the built in capabilities of the autofilter or advanced filter
or you can loop through the columns and identify the candidates.

Your claimed use of data validation makes no real sense since validation
does not provide a unique list automatically.

--
Regards,
Tom Ogilvy


Mr B said:
Howdy,

Trying agian to get an answer on how to do this. I've seen the tutorial about having each category
in it's own list but this doesn't work for me. Here's the setup.

I have data in a bunch of columns (like an access database view).
The columns are Item_Tag, Item_Type, Item_ID, Item_Model

I want to have Dropdown1 be a list of all the different values under Item_Type. Ideally if I could
just code it to go through the lsit and pul out unique values and put them in the dropdown that'd be
great. However for now I have a macro that goes through and pulls out the unique items through data
validation and then have the dropdown populate from there. This works fine.

However, what I want to happen is whatever item is chosen from the
Item_Type dropdown, I then need
 
K

Kalle

sub FillListItemTypeUnique
dim i as integer
dim items as string
lstItemType.Clear
i= 1
do while not isempty( ItemTab.Cells( i , ValueOfYourItemTypeColum)
if inStr ( , items , ItemTab.Cells( i ,
ValueOfYourItemTypeColum )) <>0
items = items & ItemTab.Cells( i, ValueOfYourItemTypeColum )
lstItemType.additem ItemTab.Cells( i,
ValueOfYourItemTypeColum )
end if
i = i+1
next
end sub

to fill the second list:

sub YourItemTypeListBoxName_Change()
lstItems.clear
do while not isempty ( ItemTab.Cells( i , ValueOfYourItemColum))
if ItemTab.Cells( i , ValueOfYourItemColum) = lstItemType.text
lstItems.additem ItemTab.Cells( i , ValueOfYourItemColum)
end if
i = i +1
next
end sub

just written the code. not tested.
(should work...)
 
G

Guest

I meant that I used the Advanced Filtering to create the items (and disallow the duplicates) and then the Data Validation to pull those entries into the dropdown. That works fine for the first one, but not for the second one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top