ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 column List box (https://www.excelbanter.com/excel-programming/300574-2-column-list-box.html)

David Adamson[_3_]

2 column List box
 
I'm trying to fill a 2 column list box.



I am not referencing the second column correctly as the results appear in
the same column. I have had a good look through some stuff but can't work
out where I'm going wrong.



Thanks in advance



------------------



With Worksheets("MD Catch " & Area_Selection.Which_Catchment.ListIndex + 1)



'The range is row 6, column 1 , ("a6:b,end")then find end of columns by
codes

Set rng = Range(.Cells(6, 1 + col), .Cells(Rows.Count, 2 + col).End(xlUp))

vArr = rng.Value



'select form "Area-Selection and clear drop down box " ZoneDefinition"

Area_Selection.ZoneDefinition.Clear



'then retrieve the data

j = -1

For i = LBound(vArr) To UBound(vArr)

j = j + 1

'then paste list data into form "Area-Selection and drop down box
"ZoneDefintion"

Area_Selection.ZoneDefinition.ColumnCount = 2



Area_Selection.ZoneDefinition.AddItem vArr(i, 1)

Area_Selection.ZoneDefinition.List(j, i) = rng(i, 1).Row

Area_Selection.ZoneDefinition.AddItem vArr(i, 2)

Area_Selection.ZoneDefinition.List(j, i) = rng(i, 2).Row



Next



End With



David Adamson[_3_]

2 column List box
 
Don't worry have used .list property instead





All times are GMT +1. The time now is 07:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com