Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Accessing combobox/listbox values


This is a very basic question..

I have several Combo Boxes on one sheet with macros for each. I'm
trying to change the selected item in one Combo Box based on the value
of another. My problem is in accessing the Combo Box, I can't find any
help on how to do it. The examples don't help, using something like:

ComboBox1.AddItem "Duck"

Gets me a "Object Required" error.

I have the boxes 'named' "DropDown1", "DropDown2", etc.

Specifically I'd like to do this: If I particular value is selected in
one Combo Box, I'd like to set another Combo Box to a different value.
Hmm, that doesn't sound informative, I'll try this:

"DropDown1" has items of "none" and "SCSI".

"DropDown2" has items of "none" and "SCSI controller model X"

Both are at "none" by default, but when I select "SCSI" in the first
box I want the second box to switch from "none" to "SCSI controller
...." automatically.

I've tried this:

Worksheets("Sheet1").ComboBox("DropDown2") etc. -- This is the part
where I'm not doing something right (This particular example gets me
"Object doesn't support this method".)

How do I specifically reference a List Box or ComboBox by name (or
whatever I need to do)?

Thanks in advance for your help!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Accessing combobox/listbox values

If you have your Comboboxes named Dropdown1, Dropdown2 then you cannot use
this:
ComboBox1.AddItem "Duck"
The error you are getting is because the code cannot find a combobox named
Combobox1. Change it to:
Dropdown1.AddItem "Duck"

For the next problem, I don't know how you're doing your entries but I used
this code to change the combobox 2 value based on the combobox 1 value. The
only thing is this will require either a large IF statement if you have
several items or you can use a Select Case method. For better results look
in the Help for vlookup, I think that will be the best route.

HTH

"eggrock" wrote in message
...

This is a very basic question..

I have several Combo Boxes on one sheet with macros for each. I'm
trying to change the selected item in one Combo Box based on the value
of another. My problem is in accessing the Combo Box, I can't find any
help on how to do it. The examples don't help, using something like:

ComboBox1.AddItem "Duck"

Gets me a "Object Required" error.

I have the boxes 'named' "DropDown1", "DropDown2", etc.

Specifically I'd like to do this: If I particular value is selected in
one Combo Box, I'd like to set another Combo Box to a different value.
Hmm, that doesn't sound informative, I'll try this:

"DropDown1" has items of "none" and "SCSI".

"DropDown2" has items of "none" and "SCSI controller model X"

Both are at "none" by default, but when I select "SCSI" in the first
box I want the second box to switch from "none" to "SCSI controller
.." automatically.

I've tried this:

Worksheets("Sheet1").ComboBox("DropDown2") etc. -- This is the part
where I'm not doing something right (This particular example gets me
"Object doesn't support this method".)

How do I specifically reference a List Box or ComboBox by name (or
whatever I need to do)?

Thanks in advance for your help!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements


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
Combobox/Listbox Difference WLMPilot Excel Discussion (Misc queries) 1 November 21st 06 01:46 PM
Combobox v Listbox MBlake New Users to Excel 5 April 24th 05 11:58 AM
Combobox/listbox FSt1 Excel Discussion (Misc queries) 3 January 4th 05 06:55 PM
Combobox or Listbox Kathy[_7_] Excel Programming 2 December 4th 03 03:48 PM
listbox-combobox category GUS Excel Programming 1 September 12th 03 04:52 PM


All times are GMT +1. The time now is 01:27 PM.

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"