delete value if adjacent cell changed

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,028
Office Version
  1. 365
Platform
  1. Windows
I am using dependent validation to give some flexibility in a model. first drop down gives the users several options. The second list, dependent on the first choice, is either a hyphen, or one of several other options. So, if the user picks option A in the first drop down, the adjacent cell becomes " - ". Selecting options B-F, will result in the a range of other values from which they can select. That part is fine. However, if the user, for whatever reason, comes back later and changes the selection in the first list, they may not think to also reselect the second option. so, is the only way to do a sheet change event in VBA?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
i have used the following and solved my own question. easy peasy.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Application.Intersect(Range("c4:c500"), Range(Target.Address)) Is Nothing Then
   If Target <> CellValue Then
       Target.Offset(0, 1).ClearContents
      Target.Offset(0, 2).ClearContents
   End If
End If

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,216,747
Messages
6,132,483
Members
449,729
Latest member
davelevnt

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