Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Issue
Hi,
I have a cell value in excel B6 I also have combobox1 What I would like to do is if B6 = "Number 1" then populate the combobox with the text range C1:C3 If B6 = "Number 2" then populate the combobox with the text range D1:D3 Is this possible, if so can somebody please help??? Thanks for any help Andy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Issue
Is it a control toolbox combox?
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Target.Address = "$B$6" Then Select Case Target.Value Case "Number 1": Me.ComboBox1.ListFillRange = "C1:C3" Case "Number 2": Me.ComboBox1.ListFillRange = "D1:D3" 'etc End Select End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips "Andy" wrote in message o.uk... Hi, I have a cell value in excel B6 I also have combobox1 What I would like to do is if B6 = "Number 1" then populate the combobox with the text range C1:C3 If B6 = "Number 2" then populate the combobox with the text range D1:D3 Is this possible, if so can somebody please help??? Thanks for any help Andy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Issue
Hi Bob,
That works exactly as I needed and it doesn't appear to matter that the columns are hidden, Fantastic! Many Thanks Andy "Bob Phillips" wrote in message ... Is it a control toolbox combox? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Target.Address = "$B$6" Then Select Case Target.Value Case "Number 1": Me.ComboBox1.ListFillRange = "C1:C3" Case "Number 2": Me.ComboBox1.ListFillRange = "D1:D3" 'etc End Select End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips "Andy" wrote in message o.uk... Hi, I have a cell value in excel B6 I also have combobox1 What I would like to do is if B6 = "Number 1" then populate the combobox with the text range C1:C3 If B6 = "Number 2" then populate the combobox with the text range D1:D3 Is this possible, if so can somebody please help??? Thanks for any help Andy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
ComboBox Issue: Write to WorkSheet | Excel Programming | |||
Another ComboBox Issue | Excel Programming | |||
Another ComboBox Issue | Excel Programming | |||
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox | Excel Programming |