VBA code to reset dependent dropdown

Donutderek

New Member
Joined
Jun 19, 2019
Messages
25
Hello,

I've got a workbook I've been working on with primary drop-downs located in col G, cells 13, 14, 15,(merged cell with H&I), my dependent drop-down is in C of the same rows. (Merged cell with D). Despite trying codes copied from forums here and adjusting the locations to my situation, I can't seem to get it to work when I test it. I'm trying to get the dependent drop to reset when my primary value has been changed. Nothing I've tried seems to work.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Sorry, obviously I'm new to coding this, any help would be appreciated in how to handle this. Thank you!
 
Upvote 0
can you post your code (whatever you have)?

I've tried copy and pasting multiple ones from this forum, but the latest one I have is this:

Private Sub Worksheet_Change (ByVal Target As Range)
If Target.Address = "$G$13:$G$15" Then
Target.Offset (0,-4).Value = " "
End If
End Sub


I don't know the best way to go about this, but it doesn't seem to matter what examples I've tried, it never tests correctly.
 
Upvote 0
so if i understand your code (should work), you would clear the contents of G17 to G19 if the cells in G13 - G15 change, is that correct?
 
Upvote 0
If that's the code I've put in, then no wonder it doesn't work. Lol. I would like to clear contents of cell C13 if G13 changes, clear C14 if G14 changes, etc.
 
Upvote 0
You're code is looking to clear col C.
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G13:G15")) Is Nothing Then
   Target.Offset(0, -4).Value = ""
End If
End Sub
 
Last edited:
Upvote 0
Omg. Fluff. That did it. Thank you so much!
One last question:
Is it possible to populate cell D13 (same row) based on selection of dependent dropdown? (The value I want to put in there is in the cell directly next to where the source of dropdown selection is). I can't find anything about this, (VBA or formula) but I'm likely not wording it properly.

Example: Dependent dropdown is in C13: selection source is located in Sheet 2, cell A4.
Can I populate D13 automatically with the info from Sheet 2, cell B4?
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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