Worksheet_Change(ByVal Target As Range)

julhs

Active Member
Joined
Dec 3, 2018
Messages
471
Office Version
  1. 2010
Platform
  1. Windows
My goal is to “Reset” to “Clear/Blank/Empty/Nothing” Combobox #3 and #4 on “Change” of Combobox #2

I have a Userform that has 4 Comboboxes, #1 is NOT dependent on ANY and works independently. #2 is the Primary the one ; it IS connected TO, but NOT dependent on either #3 or #4.
Both #3 & #4 ARE dependent on #2.
#4 is also dependent #2, but only really dependent on #3

As I have used a “Change Event” earlier for “cmbExpenditureSubGroups”, it appears I can’t re-use “Change Event” again for the same “Combobox”, just get “Ambiguous Name” error.

So I thought I could try different approach and use “Worksheet_Change(ByVal Target As Range)”
But I can’t get it it to operate;
Relevant info;
Combobox#2 = cmbMainExpenditureGroups
Combobox#3 = cmbExpenditureSubGroups
Combobox#4 = cmbSubGroupsList
and using “Named Ranges” to fill all Comboboxes
This is the code that is not working/resetting things.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = cmbMainExpenditureGroups Then
Range(cmbExpenditureSubGroups).Value = ""
Range(cmbSubGroupsList).Value = ""
If Target.Address = cmbExpenditureSubGroups Then
Range(cmbSubGroupsList).Value = ""
End If
End If
Application.EnableEvents = True
End Sub
 
Unfortunately don’t have any File Sharing capability.

But I could Private Message (PM) you;
the UserForm code and a “JPG” image of the “UserForm”
But it does mean you’d have to create a UserForm with 3 ComboBox’s.
Are you up for that? (Can assure you there are NO external links in the code that will cause you issues)

Goes without saying I WILL post the outcome to this and give credit for it!
If you are NOT up for a “PM” then I will simply have to upload it to the forum!!??
 
Upvote 0

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,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

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