ActiveX Switching From One Sub to Another

MIdathUK72

New Member
Joined
Apr 7, 2022
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi

I'm trying to use vba to filter different lists on the same spreadsheet - so for example I have a list of departments and the teams within, and the same thing for region and location. I'm using these to create dynamic ranges to populate active x combo boxes - so, select a department then the box for teams only contains relevant teams, and the same for region and location.

Here is my code:

Private Sub ComboBox1_Change()
Sheets("Options").AutoFilterMode = False
Sheets("Options").Range("$G$1:H1").AutoFilter Field:=1, Criteria1:=ComboBox1.Value
Application.DisplayAlerts = True
Sheets("Options").Range("H:H").SpecialCells(xlCellTypeVisible).Copy
Sheets("Working").Range("A1").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

Private Sub ComboBox4_Change()
Sheets("Options").AutoFilterMode = False
Sheets("Options").Range("$p$1:q1").AutoFilter Field:=1, Criteria1:=ComboBox4.Value
Application.DisplayAlerts = True
Sheets("Options").Range("H:H").SpecialCells(xlCellTypeVisible).Copy
Sheets("Working").Range("A1").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

When I make a change to ComboBox1, it then jumps to the ComboBox4 code......

I'm also really confused about the autofilter, in terms of turning it off and on...

Grateful for any help!
M
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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