How not to use ComboBox change event?

Waimea

Active Member
Joined
Jun 30, 2018
Messages
465
Office Version
  1. 365
Platform
  1. Windows
Hi,

I want to use a select case for the value of a combobox but I don't want to use the combobox change event?

Ex. If combobox1.ListIndex = 1 I want a macro to run, and if combobox1.listindex = 2 I want another macro to run?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You could use the Click event
 
Upvote 0
Hi Fluff,

thank you for your reply!

Could I use a select case in another macro based of the value of combobox1.listindex?
 
Upvote 0
I have one activex combobox1 with 22 options and I have one dependent activex combobox2 with 1 to 59 options for a total of 320 options.

I want to run a macro on the selected option in combobox2. However I don't want to create 320 select case statements.

How can I use select case without creating 320 select cases?
 
Upvote 0
Give us a example of what you will be loading into these comboboxes.
Where do these values come from?
 
Upvote 0
Hi My Aswer Is This,

in the first combobox I have countries, Sweden, Norway etc. In the second combobox I have city names, Stockholm, Oslo, etc.

I am looking at nested select cases with one select case for combobox1 and then nested select cases for city names.
 
Last edited:
Upvote 0
Where on your sheet do you have these names.
They have to be loaded into the combobox from some place
 
Last edited:
Upvote 0
Hi My Aswer IS This,

I don't have 320 scripts, I have a total of 320 cities in 22 countries.

Code:
Select Case ComboBox1.ListIndex

Case 0
   
    Select Case ComboBox2.ListIndex

    Case 0
    call a function with some variables

    Case 1 
    call the same function with different parameters

    End select
End select
 
Upvote 0
The countries and the cities are in named ranges on a worksheet.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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