Creating Dependent Drop-Down Lists

ChryslerPt

New Member
Joined
Sep 23, 2011
Messages
2
Hello everyone,
I have a quick question that might be simple to figure out for some.

I am trying to get a listbox I created in from DataValidation to be dependent on another list.

For example, when I select Course 1 (a list item) from the Course List drop-down, I want the cost to auotmatically populate in the Cost drop-down (the other list).

How do I get this to happen? Here is the code I created in VB, and I am not sure if this is the right course of action:

Sub Automated()
Sheet1.Cells(2, 1) = "MATLAB"
If (Sheet1.Cells(2, 1) = "MATLAB") Then
Sheet1.Cells(2, 3) = "31"
End If
Sheet1.Cells(2, 1) = "INCA"
If (Sheet1.Cells(2, 1) = "INCA") Then
Sheet1.Cells(2, 3) = "41"
End If

Sheet1.Cells(2, 1) = "TargetLink"
If (Sheet1.Cells(2, 1) = "TargetLink") Then
Sheet1.Cells(2, 3) = "51"
End If

If ((Sheet1.Cells(2, 3) = "0") Or (Sheet1.Cells(3, 2) = 0)) Then
Sheet1.Cells(2, 3) = "3999"
End If

End Sub


I don't want to use the user form, however from VB. I want to use the regular drop-down. The code seems to work, but, each list item in the drop-down is not pulling the data I want it to. I need to activate the drop-down as a click event somehow. It's just recognizing the cell A2 as a whole and not the individual list items. I want to each list item to be their own object, and to automatically populate the cell C2 with their cost when they are selected.

Thanks everyone. :)
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi VoG,

Thank you for the response. Unfortunately, that is not what I am looking for. It's similiar, but not quite.

If I select a list item from A2, then I want it's cost to automatically pop in cell C2. I want it to be like a quick find.

Is this easy to accomplish or not in Excel?

Thanks again for your response.:)
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,741
Members
452,940
Latest member
rootytrip

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