drop down boxes

Loreng

New Member
Joined
Sep 23, 2004
Messages
31
I have used Data....Validation to create 2 dropdown boxes in adjacent cells (repeated about 50x down the page). The second drop down (col c) is dependant on the selection in the first cell (col b), which I achieved by using the indirect function in the source input (figured that out by reading board archive...Thanks, great tool).

My problem arises when a the user changes, or deletes the first cell. The old value remains in the second drop down.

How can I get the second cell to erase when the first is changed?

Is there an event trigger in VBA, that says if any cell in a row changes, then delete the cell 1 row to the right?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Let's say you have your dropdowns in cell A1 and B1, and you want to make B1 blank.

1. Press Alt-F11 to bring up VBA
2. In the left-pane, double-click the sheet to which you want to attach this
3. Paste this into the right pane:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then [b1].ClearContents
End Sub
 
Upvote 0
If you want to adapt it for the whole column, then:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then Target.Offset(0,1).ClearContents
End Sub
 
Upvote 0
arrrgh...more help w/ VBA code

What if, instead of the entire column, I only want to apply the code to a range B19-B105?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target = B19:B105 Then Target.Offset(0,1).ClearContents
End Sub


the above is what I want it to do, but does not work
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,920
Members
448,533
Latest member
thietbibeboiwasaco

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