listbox

G

Guest

I want to make a selection (entire row) from a worksheet en place this row(s)
in a listbox.
So far I'm able to place the cells from the selected row vertically in the
listbox, but I want the row horizontaly (in columns) placed in the listbox.
When I use the next formula, I get all the rows horizontally

With ListBox1
.ColumnCount = Range("rFactTot").Columns.Count
.RowSource = "rFactTot"
.ListIndex = 0
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
End With

But I want to add an if--then statement that only places rows which meet the
criteria from rFactTot I want.

Anybody knows the solution??
 
B

Bob Phillips

With ListBox1
.ColumnCount = Range("rFactTot").Columns.Count
.RowSource = Range("rFactTot").Address
.ListIndex = 0
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
End With


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
G

Guest

Bob,
This is not what I want, the macro looks like this:

Private Sub UserForm_Initialize()
If [rFact].Count = 1 Then
MsgBox ("Er is nog geen factuur aangemaakt")
Unload Me
End
End If
'Selecteren niet betaalde facturen en plaatsen in listbox
Sheets("Factuurlijst").Activate
Dim factuur As String
Dim dag1, dag2 As Date
Dim nr, waar, tel As Integer
waar = 0
tel = 2
nr = Range("rFact").Cells.Count - 1
For i = 1 To nr
tel = tel + 1
dag1 = Date
dag2 = Cells(tel, 2).Value
dag3 = dag1 - dag2
If Cells(tel, 5) <> "X" And dag3 > 30 Then
factuur = (Range("A" & tel).Value) 'this should be the complete
row A, how do I do that
ListBox1.AddItem factuur 'add the complete row to the listbox
waar = waar + 1
End If
Next i
If waar = 0 Then
MsgBox ("Er hoeven geen aanmaningen verstuurd te worden")
End
Unload Me
End If
'now I get the complete worksheet and I want only the items from factuur in
the listbox
With ListBox1
.ColumnCount = Range("rFactTot").Columns.Count
.RowSource = Range("rFactTot").Address
.ListIndex = 0
.MultiSelect = fmMultiSelectMulti
.ListStyle = fmListStyleOption
End With
End Sub

I hope you understand what I want
with regards
Luthor
(The Netherlands)


"Bob Phillips" schreef:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top