Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default change list in combo box

I have a combo box called cb1 with a list of values (p1:p2). I have a secong
combo box cb2 that i would like the list to change depending on what is
chosen in cb1. If the first option is chosen I'd like the data in cells Q1:Q8
to be the list and if the second option is chosen I'd like R1:R6 to be the
list in CB2. Thanks for any help.

Qaspec
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default change list in combo box

Hi,

Assuming your comboboxes are in a userform, then use:

Private Sub cb1_Change()
Dim pos As Long
pos = cb1.ListIndex

If pos = 0 Then 'Case first item is chosen
cb2.RowSource = "Sheet1!Q1:Q8"
ElseIf pos = 1 Then 'Case second item is chosen
cb2.RowSource = "Sheet1!R1:R6"
Else 'Case else
cb2.RowSource = ""
End If
End Sub

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Qaspec" wrote:

I have a combo box called cb1 with a list of values (p1:p2). I have a secong
combo box cb2 that i would like the list to change depending on what is
chosen in cb1. If the first option is chosen I'd like the data in cells Q1:Q8
to be the list and if the second option is chosen I'd like R1:R6 to be the
list in CB2. Thanks for any help.

Qaspec

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
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
List Box or Combo Box Finneous J Whoopee Excel Discussion (Misc queries) 0 March 5th 08 06:15 PM
List box or Combo box?? Jock Excel Discussion (Misc queries) 1 September 17th 07 02:06 PM
Combo box or list box famdamly Excel Discussion (Misc queries) 2 January 11th 06 02:58 AM
Before and after combo box change Dale[_7_] Excel Programming 1 October 7th 03 03:12 PM


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