trying to get some ...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] trying to get some combo boxes to work in VBA excel

0 Posts
1 Users
0 Reactions
53 Views
 mrmo
Posts: 10687
Free Member
Topic starter
 

Issue i have is that i can't figure out how to cope with a combo box where you dono't know the number of items before you create it. I assume that there must be away of showing the whole array of values and not just the first X regardless of whether there is or isn't any content.

How?

Private Sub combobox2_change()

Range("c27").Select
cellcb2 = ComboBox2.Value
Do Until ActiveCell.Value = cellcb2
ActiveCell.Offset(0, 1).Select

Loop

'workdown the list
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
combo3(j) = ActiveCell.Value
j = j + 1
Loop

ComboBox3.List = Array(combo3(1), combo3(2), combo3(3), combo3(4), combo3(5), combo3(6), combo3(7), combo3(8))

Range("c38").Select
cellcb3 = ComboBox2.Value
Do Until ActiveCell.Value = cellcb3
ActiveCell.Offset(0, 1).Select

Loop

'workdown the list
Do Until IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
combo4(k) = ActiveCell.Value
k = k + 1
Loop

ComboBox4.List = Array(combo4(1), combo4(2), combo4(3), combo4(4), combo4(5), combo4(6), combo4(7), combo4(8))
End Sub


 
Posted : 08/03/2010 12:01 pm

6 DAYS LEFT
We are currently at 95% of our target!