Changes to dependency lists delete 'child' information

Richard44444

New Member
Joined
Aug 10, 2018
Messages
1
Hi

I know this has been covered a few times and people have posted replies, from which I copied and amended some code which first worked and now does not for some reason. Can anyone help?

I have 4 column dependency lists with info in G4, H4, I4 and I4, If any changes are made to G4 I want all other columns to clear data, for H4 I want I4 and J4 to clear any content and if I4 is changed I want J4 data to clear.

I have used the following which worked for about a week but has now stopped working.

Private Sub Worksheet_Change(ByVal Target As Range)
'When G4 changes, H4 clears, and I4, J4 all clear.
If Target.Address(0, 0) = "G4" Then
Range("H4:I4, J4").ClearContents
'When H4 changes, I4, J4 all clear.
ElseIf Target.Address(0, 0) = "H4" And Range("A1").Value <> "N" Then
Range("I4:J4").ClearContents
'When I4 changes, J4, all clear.
ElseIf Target.Address(0, 0) = "I4" And Range("A1").Value <> "N" Then
Range("J4").ClearContents
End If
End Sub

Help appreciated by a coding beginner
Richard
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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