Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Set the value of a combobox Bruce Excel Programming 2 April 27th 05 09:20 AM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
Populating combobox from another combobox David Goodall Excel Programming 1 September 12th 04 03:42 PM
Combobox Scott Excel Programming 2 July 23rd 03 02:49 PM


All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"