View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arjan Arjan is offline
external usenet poster
 
Posts: 29
Default Data is added in 1 column instaed of 4 columns (in listbox)

Hi all,

I am adding a range of data (4 coloms wide) from a worksheet to a listbox
with a commandbutton.
However, the data is 4 coloms wide. The data added is put below each other
instead of besised each other..

What can I do to make the data in the 4 coloumns?

Please find below my code I use at this moment..


---------------------------------------------
Private Sub Commandbutton1_Click()
' bepalen hoe breed de kolommen moeten zijn
Me.ListBox1.ColumnWidths = "360;28;53;50"

'hier wordt de listbox range bepaald zodat de juiste range in het juiste
tabblad komt.
Dim dpv2 As Long
Dim dpv22 As Long

ListBox1.Clear
ListBox1.ColumnCount = 4
ListBox1.RowSource = ""
For dpv2 = 1 To 63
ListBox1.AddItem Sheets("DPV 2").Range("a" & dpv2).Value
ListBox1.AddItem Sheets("DPV 2").Range("b" & dpv2).Value
ListBox1.AddItem Sheets("DPV 2").Range("c" & dpv2).Value
ListBox1.AddItem Sheets("DPV 2").Range("d" & dpv2).Value
Next dpv2

End Sub
------------------------------------------

Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****