ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "implant" ActiveX ComboBox value into if eq'n (https://www.excelbanter.com/excel-programming/440230-implant-activex-combobox-value-into-if-eqn.html)

Steve

"implant" ActiveX ComboBox value into if eq'n
 
Morning all.
Ok, I've got my combox active to where I can read the names in the list.
I'd now like to have an if equation that will pull the value I select in the
combobox.

Do I have to write a secondary macro/function for that, or can I do it
directly on the worksheet?



Philosophaie

"implant" ActiveX ComboBox value into if eq'n
 
Private Sub ComboBox1_Change()
Select Case ComboBox1.Text
Case "Item1"
MsgBox ("Item1")
Case "Item2"
MsgBox ("Item2")
Case "Item3"
MsgBox ("Item3")
Case "Item4"
MsgBox ("Item4")
Case "Item5"
MsgBox ("Item5")
End Select
End Sub

Substitute the name of the text and the code you want to execute for the
Msgbox .

"Steve" wrote:

Morning all.
Ok, I've got my combox active to where I can read the names in the list.
I'd now like to have an if equation that will pull the value I select in the
combobox.

Do I have to write a secondary macro/function for that, or can I do it
directly on the worksheet?



Philosophaie

"implant" ActiveX ComboBox value into if eq'n
 
Make sure "Combobox_Change" is in "Sheet1", "Sheet2", etc. not in
"ThisWorkbook" where you add the names:

Sheets("Sheet1").Combobox1.additems "Name1", etc


Steve

"implant" ActiveX ComboBox value into if eq'n
 
Hi "Phil"
Let me guess, you're a Newton fan (his big Principia Phil. text).

Let me understand this...
I need to place the code you offered in the workbook that my comboboxes are
in-- and not my source list workbook?

I.e., my source list is located in my personal.xlsb workbook.

We've been making all our macros as globals, by either placing them in the
personal.xlsb, or our xlam files.

I prefer to keep it that way.

"Philosophaie" wrote:

Make sure "Combobox_Change" is in "Sheet1", "Sheet2", etc. not in
"ThisWorkbook" where you add the names:

Sheets("Sheet1").Combobox1.additems "Name1", etc



All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com