![]() |
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 |
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 |
All times are GMT +1. The time now is 10:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com