Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
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
ComboBox Issue: Write to WorkSheet Paul Martin Excel Programming 2 May 17th 05 05:53 AM
Another ComboBox Issue Darrin Henry[_2_] Excel Programming 2 April 16th 05 03:03 PM
Another ComboBox Issue Darrin Henry[_2_] Excel Programming 1 April 16th 05 09:18 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


All times are GMT +1. The time now is 04:37 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"