VBA code to select an item from an Active X combo box

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
929
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am looking for the VBA code that would select from a combo box the item that says "ALL".

It is cell reference A21 on a seperate sheet called "List"

I hope someone can help me.

Thank you

Carla
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Is the data "All" already loaded in the combo?
When do you want to select the "All" data, when you open the book?
Or what moment?
 
Upvote 0
my List fill Range is A1:A255. The Word "ALL" is A21 on the list.

I put a button on the sheet called "Refresh" that runs a Macro I made to refresh all the data.
When the Macro runs I would like to add some code to have the combo box selection change to "ALL".
My bosses want to look at "ALL" data first after running the Macro (refreshing the data).
 
Upvote 0
I get Run-time error '424': Object required

I only have the one combo box and it is named ComboBox1
It is an ActiveX ComboBox (not sure if this makes a difference in the code)

Thank you

Carla
 
Upvote 0
Try

Code:
[COLOR=#0000ff]ActiveSheet[/COLOR].ComboBox1.Value = "All"

If you have problems, you can put all your code here.
What version of Excel do you have?
 
Upvote 0
This worked perfectly, thank you soooo much!
My sheet was due and this was the last piece I just couldn't get to work and I knew it was something simple. You really saved me, thank you again :):)
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,118
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