Linked Data Validation(s)

M

mrhilder

I have 4 cells all beside each other in my Excel Spreadsheet. They
are all data validations that are linked to one another. I.E. each
depends on the input from the previous cell. I'm looking for a code
that will clear the cells (but keep the data validations) if I change
one of the previous cells. For Example: Cell 1 contains these
items: Shovel, Axe, and a Saw. If I choose Shovel in the first cell
then my options for the second cell are now Flat or Round. Then the
third box will give me the price depending on which I choose. However
the problem is that once I pick the Flat and the price shows up, If I
choose that I would rather have the Round and I go back and select
it. The same price that the Flat shovel still shows in its cell even
after I select Round until I go and physically do the drop down menu
again for its price. I'm looking for a code that once I change my
mind and go with the Round, then the next cell otimatically goes back
to blank as if I havent ever clicked on it. Hope this makes sense.
Any help is greatly apprieciated
 
P

Phillip

Assume the data validations are in cells A1 to C1
Right click the sheet tab and select View Code

Paste the following code in the sheet module
Modify the addresses in the code as required for your sheet layout

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$A$1" Then
Range("B1:C1").ClearContents
ElseIf Target.Address = "$B$1" Then
Range("C1").ClearContents
End If
Application.EnableEvents = True
End Sub
 
D

Dave Peterson

Check your other post for more responses.

I have 4 cells all beside each other in my Excel Spreadsheet. They
are all data validations that are linked to one another. I.E. each
depends on the input from the previous cell. I'm looking for a code
that will clear the cells (but keep the data validations) if I change
one of the previous cells. For Example: Cell 1 contains these
items: Shovel, Axe, and a Saw. If I choose Shovel in the first cell
then my options for the second cell are now Flat or Round. Then the
third box will give me the price depending on which I choose. However
the problem is that once I pick the Flat and the price shows up, If I
choose that I would rather have the Round and I go back and select
it. The same price that the Flat shovel still shows in its cell even
after I select Round until I go and physically do the drop down menu
again for its price. I'm looking for a code that once I change my
mind and go with the Round, then the next cell otimatically goes back
to blank as if I havent ever clicked on it. Hope this makes sense.
Any help is greatly apprieciated
 

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