listbox multi column problem

likexl

New Member
Joined
May 7, 2011
Messages
18
Hi,

I am trying to code 7 multi column in listbox, but trapped.

code :
Do Until NumCounta = 1
NumCounta = NumCounta - 1
a = Range("a" & x).Value
b = Range("d" & x).Value
c = Range("e" & x).Value
d = Range("f" & x).Value
e = Range("h" & x).Value
f = Range("i" & x).Value
g = Range("j" & x).Value
x = x + 1

'this gives records in different row.
'want all in one row and aligned.
Me.ListBox1.AddItem a
Me.ListBox1.AddItem e
Me.ListBox1.AddItem f
Me.ListBox1.AddItem g
Me.ListBox1.AddItem b
Me.ListBox1.AddItem c
Me.ListBox1.AddItem d
Loop

using xl 2003, win7
thanks.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
For instance:

Code:
Sub f()
    Do Until NumCounta = 1
        NumCounta = NumCounta - 1
        With Me.ListBox1
            .AddItem Range("A" & x).Value
            .List(.ListCount - 1, 1) = Range("h" & x).Value
            .List(.ListCount - 1, 2) = Range("i" & x).Value
            .List(.ListCount - 1, 3) = Range("j" & x).Value
            .List(.ListCount - 1, 4) = Range("d" & x).Value
            .List(.ListCount - 1, 5) = Range("e" & x).Value
            .List(.ListCount - 1, 6) = Range("f" & x).Value
            x = x + 1
        End With
    Loop
End Sub
 
Upvote 0
Re: listbox multi column problem solved

Thanks wigi for quickly reformating the logic of range problem.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top