PDA

View Full Version : [SOLVED] Multi listbox



gibbo1715
01-27-2005, 04:24 AM
Hope this is a simple one for you

I have the code below to display a 2 column multilistbox from a dynamic array


Dim Rng As Range
Dim Cell As Range
Me.ListBox1.Clear
With ThisWorkbook.Sheets("Exhibits")
Set Rng = .Range("A2", .Range("A65536").End(xlUp))
End With
For Each Cell In Rng.Cells
With Me.ListBox1
Me.ListBox1.AddItem Cell.Offset(0, 2).Value
.List(.ListCount - 1, 1) = Cell.Value
End With
Next Cell


How can I make it for a 4 column listbox?

Jacob Hilderbrand
01-27-2005, 04:29 AM
Try this.


Dim LastRow As Long
Me.ListBox1.Clear
With ThisWorkbook.Sheets("Exhibits")
LastRow = .Range("A65536").End(xlUp).Row
Me.ListBox1.RowSource = .Range("A2:D" & LastRow).Address
End With

Just change the RowSource to the actual range you want.

gibbo1715
01-27-2005, 04:46 AM
Absolutely perfect once again

Thank you

Jacob Hilderbrand
01-27-2005, 04:47 AM
You're Welcome :beerchug:

Take Care