PC Review


Reply
Thread Tools Rate Thread

Dynamic Combobox

 
 
Dennis
Guest
Posts: n/a
 
      6th Apr 2008
I have been searching hours for a solution and haven't had any luck finding a
solution to the problem the follows. At first, this seemed a simple task.

Simple story: I have a combobox that is prepopulated and I want a second
combobox to react in drill-down fashion to the change event of the first.

Simple, Right?

The combobox is an in-sheet combobox (i.e., not on a user form and not
created dynamically at run-time) that will be visible 100% of the time. When
the first value changed event occurs - I want to remove all of any previously
loaded data in the second combobox and re-popluate the list from a different
data source (that may be in or outside of the workbook). I can access windows
forms objects if on a userform by name - but, how do I access the object if
it's "in-sheet"?

Anyway, I guess the need here is: how do I access the properties of windows
form control in-sheet and not in a userform.

Any help would be greatly appreciated.
 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      6th Apr 2008
Put this into the sheet module that has you
combobox in them
Private Sub ComboBox1_Change()
Dim c As Variant
ComboBox2.Clear
For i = 1 To 10
Set c = Range("A" & i)
ComboBox2.Value = c
ComboBox2.AddItem (c)
Next
End Sub

"Dennis" wrote:

> I have been searching hours for a solution and haven't had any luck finding a
> solution to the problem the follows. At first, this seemed a simple task.
>
> Simple story: I have a combobox that is prepopulated and I want a second
> combobox to react in drill-down fashion to the change event of the first.
>
> Simple, Right?
>
> The combobox is an in-sheet combobox (i.e., not on a user form and not
> created dynamically at run-time) that will be visible 100% of the time. When
> the first value changed event occurs - I want to remove all of any previously
> loaded data in the second combobox and re-popluate the list from a different
> data source (that may be in or outside of the workbook). I can access windows
> forms objects if on a userform by name - but, how do I access the object if
> it's "in-sheet"?
>
> Anyway, I guess the need here is: how do I access the properties of windows
> form control in-sheet and not in a userform.
>
> Any help would be greatly appreciated.

 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      6th Apr 2008
Hi Dennis,

"how do I access the properties of windows form control in-sheet "

Firstly there are two types of controls that you can apply to a worksheet.

One set is called Forms controls and I suggest that you don't uses these. I
believe that they are left over from very early versions of xl. However, if
you do use them, right click the control then you get to the properties.

The other type are ActiveX controls. I suggest that you use these. To set
the properties on these, you need to turn on Design Mode. Design Mode turns
on when you initially create the control but you need to turn it on again if
you want to edit the control. It needs to be turned off after editing/setting
properties etc to use the control. The Design Mode control is toggled on and
off by a button that looks like a set square, ruler and pencil.

To access both type of controls:-

Excel 2007: On Developer Ribbon, use the Insert button in the Controls block
and both the Forms and ActiveX controls are displayed together under separate
headings.

Pre Excel 2007: Forms controls are on the Forms toolbar and ActiveX controls
are on the Toolbox toolbar.

In Userforms, I don't think that you can access the older Forms controls or
if you can, I don't know how.

--
Regards,

OssieMac


"Dennis" wrote:

> I have been searching hours for a solution and haven't had any luck finding a
> solution to the problem the follows. At first, this seemed a simple task.
>
> Simple story: I have a combobox that is prepopulated and I want a second
> combobox to react in drill-down fashion to the change event of the first.
>
> Simple, Right?
>
> The combobox is an in-sheet combobox (i.e., not on a user form and not
> created dynamically at run-time) that will be visible 100% of the time. When
> the first value changed event occurs - I want to remove all of any previously
> loaded data in the second combobox and re-popluate the list from a different
> data source (that may be in or outside of the workbook). I can access windows
> forms objects if on a userform by name - but, how do I access the object if
> it's "in-sheet"?
>
> Anyway, I guess the need here is: how do I access the properties of windows
> form control in-sheet and not in a userform.
>
> Any help would be greatly appreciated.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic combobox =?Utf-8?B?YWx2aW4gS3VpcGVy?= Microsoft Excel Programming 1 10th Feb 2006 11:16 AM
dynamic combobox john_t_h Microsoft Excel Programming 8 11th Sep 2005 02:03 PM
Dynamic ComboBox Helen Microsoft Excel Programming 2 7th Dec 2004 08:57 PM
Dynamic Combobox alexcn Microsoft Access ADP SQL Server 1 14th Oct 2004 06:08 AM
Load dynamic data into comboBox based on input in ComboBox =?Utf-8?B?SmFzb24gU21pdGg=?= Microsoft Dot NET Framework Forms 1 31st May 2004 05:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 PM.