ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Linked Data Validation(s) (https://www.excelbanter.com/excel-programming/403444-linked-data-validation-s.html)

[email protected]

Linked Data Validation(s)
 
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

Phillip[_5_]

Linked Data Validation(s)
 

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

wrote:
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


Dave Peterson

Linked Data Validation(s)
 
Check your other post for more responses.

wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 12:09 PM.

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