How can I get a value from one drop down list to another in excel

B

Blaatann

I have created a drop down list using the data validation tool in
excel. When i chose one of the options from the drop down list, i have
another drop down list that contains different values dependent of my
choices in the first drop down list.

My problem is that when i go back to the first drop down list an change
the value there, the default value in the second drop down list don`t
change. And i have to open the second drop down list to get access to
the new values.

Is there a way to get the second drop down list to change the defalult
whenever the first drop down list i changed.

I would be really thankfull for some help one this one.
 
B

Blaatann

Thanks for the reply but that´s unfortunately not the solution for my
problem.

If you check out the sample file from the link you gave me, you will
see my problem. If i choose
fruit from the sample file:this list will appear: Apples
Oranges
Lemons
Grapes

And i can choose from the 4 different fruits. Lets say i choose Lemons.
The value in the second drop down list will be Lemons.

But if i go back and choose vegetables the value in the second drop
down list will still be Lemons.

My problem is that when i choose vegetables in the first drop down
list. I want the default value in the second drop down list to change
to the first value from the vegetable list. In this example Cabbage.

I hope you could help me with this.

Regards
Blaatann
 
R

Ron Coderre

Ahh..you're looking to change one DV cell and have another DV cell's value
automatically clear.

Here's some sample worksheet-level code that you can amend to suit your needs:

Assumptions:
Parent List cells are in A1:A10
Dependent List cells are in B1:B10

'---------Start of Code--------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngAllParentCells As Range
Dim rngDepCells As Range
Dim rngCell As Range

Set rngAllParentCells = Range("A1:A10")
Set rngDepCells = Intersect(Target, rngAllParentCells)

If Not rngDepCells Is Nothing Then
For Each rngCell In rngDepCells.Cells
'Move 1 cell to the right and clear contents
rngCell.Offset(RowOffset:=0, ColumnOffset:=1).ClearContents
Next rngCell
End If

Set rngAllParentCells = Nothing
Set rngDepCells = Nothing
Set rngCell = Nothing

End Sub
'---------End of Code--------


Is that something you can work with?

***********
Regards,
Ron

XL2002, WinXP
 

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