Private Sub UserForm_Initialize()
Dim rng As Range
ListBox1.ColumnCount = 4
Set rng = Range(Cells(2, 1), Cells(2, 1).End(xlDown))
For Each cell In rng
If cell.Offset(0, 3) = 0 Then
ListBox1.AddItem cell.Value
ListBox1.List(ListBox1.ListCount - 1, 1) = cell.Offset(0, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = cell.Offset(0, 2).Value
ListBox1.List(ListBox1.ListCount - 1, 3) = cell.Offset(0, 3).Value
End If
Next
End Sub
worked for me.
--
Regards,
Tom Ogilvy
"Angelus" <Angelus.223qiy_1138043703.1187@excelforum-nospam.com> wrote in
message news:Angelus.223qiy_1138043703.1187@excelforum-nospam.com...
>
> Alright, so here is my situation. I've tried to get this to work for a
> while now...and just can't seem to figure it out.
>
> Let's say you have columns A, B, C with data in them. Column D is a
> boolean value...true/false, 0/1, whatever.
>
> How would I populate a multi-column listbox with the data from A, B,
> and C depending on whether D is 0 or 1. So if it's 0, I want that row
> in the listbox, but if it's 1, I don't want it in the listbox. Of
> course I'd like this to work on all rows in the sheet.
>
> Could someone help me with the code for that?
>
> Thank you very much!
>
>
> --
> Angelus
> ------------------------------------------------------------------------
> Angelus's Profile:
http://www.excelforum.com/member.php...o&userid=30721
> View this thread: http://www.excelforum.com/showthread...hreadid=504144
>
Bookmarks