I have an application in excel in which a “combobox1” has been created on the main sheet of excel. Somewhere during the code execution the program requires input from the “combobox1”. What is the code required to highlight the “combobox1” allow the user to select from the box and then return control back to the regular code?
Set Focus on Combobox
-
-
-
-
Re: Set Focus on Combobox
Quoteallow the user to select from the box and then return control back to the regular code
Hi, small remark:
I think you have to write 2 procedures instead of 1 program that should interact. The first program should do the things without the combobox and the second should trigger if the user selects an item of the box. That way the box doesn't have to be activated.
(By the way I don't know how you activate the box on a sheet. selecting yes, but activating no)
-
Re: Set Focus on Combobox
I don't think the setfocus is supported for a combobox on a sheet. For a box on a form => ok, but not on a sheet.
-
Re: Set Focus on Combobox
yep...think I missed the sheet part of it
thanx for pointing out gollem
-
-
Re: Set Focus on Combobox
Quote from Phil Policelli;253917I have an application in excel in which a “combobox1” has been created on the main sheet of excel. Somewhere during the code execution the program requires input from the “combobox1”. What is the code required to highlight the “combobox1” allow the user to select from the box and then return control back to the regular code?
To setfocus on a ComboBox in a sheet you need activesheet.combobox1.activate or sheets("your sheet name").combobox.activate
to continue the rest of the code there are several ways, it would be good to have a sample of the code or more info. It seams that you have a variant that will need the ComboBox value to continue. If that is so you should have it either using something like my.variant = combobox1.value or by splinting the code.
-
Re: Set Focus on Combobox
Doubt you're going to get a copy of that workbook...
The original poster has probably forgotten all about it in the 6 years since the thread was started.
-
Re: Set Focus on Combobox
To setfocus on a ComboBox in a sheet you need activesheet.combobox1.activate or sheets("your sheet name").combobox.activate
to continue the rest of the code there are several ways, it would be good to have a sample of the code or more info. It seams that you have a variant that will need the ComboBox value to continue. If that is so you should have it either using something like my.variant = combobox1.value or by splinting the code.
Where should that code go? activesheet.combobox1.activate
-
This thread is 10 years old. I suggest you start your own thread if you have a problem to solve.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!