Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value from combobox
I am trying to get a value from my a combobox on my sheet "Update" but it
tells me object required. What have I missed? Function myRegion Dim cb_region As ComboBox With Sheets("Update") myRegion = cb_region.Value End With End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value from combobox
I think, from your question, your combobox is placed on a worksheet called
"Update". Also, I assume you have already given it a name "cb_region". On a worksheet, a combo Box is a "DropDown" object in Excel's object library. Also, you need to be careful with statements between the "With" and "End With". You seemed to missed the dot (period). I've modified your macro as follows: Function myRegion() Dim myRegion With Sheets("Update") myRegion = .DropDowns("cb_region").Value End With End Function (Again, as I've mentioned, I assume you have already assigned a name to your combo box. If not, please give it the name "cb_region".) Regards, Edwin Tam http://www.vonixx.com "Bruce" wrote: I am trying to get a value from my a combobox on my sheet "Update" but it tells me object required. What have I missed? Function myRegion Dim cb_region As ComboBox With Sheets("Update") myRegion = cb_region.Value End With End Function |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get value from combobox
is the name of your combobox on Update sheet named cb_region? if so, you
don't need to declare it as a variable. Since you are only performing one command, you can eliminate With/End With and just use myRegion = Sheets("Update").cb_region.Value "Bruce" wrote: I am trying to get a value from my a combobox on my sheet "Update" but it tells me object required. What have I missed? Function myRegion Dim cb_region As ComboBox With Sheets("Update") myRegion = cb_region.Value End With End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
Set the value of a combobox | Excel Programming | |||
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox | Excel Programming | |||
Populating combobox from another combobox | Excel Programming | |||
Combobox | Excel Programming |