VBA ComboBox

  • Thread starter Thread starter Stromma
  • Start date Start date
S

Stromma

Hi All!

I have a problem with a ComboBox ListFill Range. I use this code fo
the first ComboBox:

Sheets("Start").Select
x = Application.Match(Val(ComboBox2), Range("A2:A1002"), 0)
If IsNumeric(x) Then
ComboBox3 = Range("B2:B1002").Cells(x) 'ListFillRange
End If

ComboBox3 =cells(x), column("B") = Range("B2:B1002").Cells(x)
vertical match.
This one works ok.

But:

Then i want ComboBox4 to match:
If cells(x)= ("A2") then ComboBox4= Row("2"), Columns ("L:Q"),
= ("L2:Q2") .Cells(x) = horizontal match.

I just can't make this one work.

Suggestions?

/Stromm
 
Stronma,

Have you tried

ComboBox4 = Rows(2).Columns("L:Q").Cells(x)

or

ComboBox4 = Range("L2:Q2").Cells(x)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Hi Bob

Thanks for your reply!

Yes, i tried that without any luck...

The problem is solved with a great deal of help from Andy Pope on th
Ozgrid Forum: http://www.ozgrid.com/forum/

Here's the solution he provided:

Private Sub ComboBox3_Change()
If ComboBox3.ListIndex >= 0 Then
ComboBox2.ListIndex = ComboBox3.ListIndex
MyFillCombo
End If
End Sub

Private Sub MyFillCombo()
Dim rngTemp As Range
ComboBox5.Clear
For Each rngTemp In Range("Start!L" & ComboBox3.ListIndex + 1
":O" & ComboBox3.ListIndex + 1)
ComboBox5.AddItem rngTemp.Value
Next
End Sub

/Stromm
 
Back
Top