Worksheet_Change(ByVal Target As Range)

julhs

Active Member
Joined
Dec 3, 2018
Messages
404
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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,213,558
Messages
6,114,296
Members
448,564
Latest member
ED38

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