Need to add mutliple columns to a List Box

  • Thread starter Martin SChukrazy
  • Start date
M

Martin SChukrazy

Hello
I am working on an excel form that contains a multiselect listbox. This
listbox needs to be populated from two different tables (a join on access)
and needs to display multiple fields. Apart from using tabs, is there a
better way to use the column(s) to display these fields individually
(programmatically)
The restriction is that i cannot use a temporary worksheet and load
them up from that worksheet (ie dataacess is a range on that sheet).


Thanks
Martin
 
D

Dave Peterson

I don't know anything about access or joins, but maybe you can pick something
out of this:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long

With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) Then
MsgBox .List(iCtr, 0) & vbLf & _
.List(iCtr, 1) & vbLf & _
.List(iCtr, 2)
End If
Next iCtr
End With

End Sub

Private Sub UserForm_Initialize()

Dim iCtr As Long
With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
.ColumnCount = 3
.ColumnWidths = "25;25;25"
For iCtr = 1 To 10
.AddItem CStr(iCtr)
.List(.ListCount - 1, 1) = iCtr * 2
.List(.ListCount - 1, 2) = iCtr * 3
Next iCtr
End With
End Sub
 
Top