View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Edwin Tam[_7_] Edwin Tam[_7_] is offline
external usenet poster
 
Posts: 94
Default 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