Clearing Dependent Drop down list Excel with VBA

yousraemara

New Member
Joined
Feb 26, 2020
Messages
1
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Platform
  1. Windows
Hi Everyone,

I am found a macro online that would allow to clear a dependent drop down list, but it doesn't work.

I have a parent list that is merged from M7 till O7 and then a list that is dependent on it and ranges from Q7 till S7.

I also have a list that is depenent on the list from Q7 till S7 and this list is from W7 till Y7. Can someone please help me with what is wrong with the code below:


Private Sub Worksheet_Change(ByVal Target As Range)
' If Target cell is merged cell M7:O7 then...
If Target.Address = "$M$7" Then
' Clear contents of merged cell Q7:S7
Target.Offset(7, 0).Value = ""

End If
' If Target cell is merged cell Q7:S7 then...
If Target.Address = "$Q$7" Then
' Clear contents of merged cell W7:Y7
Target.Offset(7, 0).Value = ""
End If
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,886
Messages
6,175,198
Members
452,616
Latest member
intern444

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