Link multiple dropdown lists to always show the same value

HeebieGeebie

New Member
Joined
Oct 17, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all!

Your help with this would be greatly appreciated.

I have 2 dropdown lists using the same source. When the value in either List 1 or List 2 is changed via the dropdown, I want the other to change to match.

I've got it working for one using the below VBA code, however, if I repeat the code I end up creating some kind of infinite loop.

Any suggestions?

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("B3")) Is Nothing Then ActiveSheet.Range("D3") = Range("B3")

'If Not Intersect(Target, Range("D3")) Is Nothing Then ActiveSheet.Range("B3") = Range("D3") <-- This causes infinite loop

End Sub
 

Attachments

  • multiple_lists.png
    multiple_lists.png
    4.4 KB · Views: 6

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/17/2022  8:58:56 PM  EDT
Application.EnableEvents = False

    If Not Intersect(Target, Range("B3")) Is Nothing Then ActiveSheet.Range("D3") = Range("B3")
    If Not Intersect(Target, Range("D3")) Is Nothing Then ActiveSheet.Range("B3") = Range("D3")
Application.EnableEvents = True
End Sub
 
Upvote 0
Solution
Try this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  10/17/2022  8:58:56 PM  EDT
Application.EnableEvents = False

    If Not Intersect(Target, Range("B3")) Is Nothing Then ActiveSheet.Range("D3") = Range("B3")
    If Not Intersect(Target, Range("D3")) Is Nothing Then ActiveSheet.Range("B3") = Range("D3")
Application.EnableEvents = True
End Sub

Hey, thanks so much for responding. That solution did work initially, however, for some reason it stopped working, I tried closing/reopening, I tried running '
Application.EnableEvents = True' on it's own. Nothing happens when I change the dropdowns.

Do you have any ideas?
 
Upvote 0
Do you have any other vba code in this same sheet.
If so show me all the code you have in the sheet
 
Upvote 0
Hey, I'm not sure what went wrong but it seems to be working reliably now!! Thanks so much!
 
Upvote 0

Forum statistics

Threads
1,214,421
Messages
6,119,392
Members
448,891
Latest member
tpierce

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