Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox
I already posted this question in Excel, bur I think this is a better place:
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 the complete rows which meet the criteria from "rFactTot" I want. Anybody knows the solution?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox
To populate the listbox use the .List property of the listbox which lets you
specify individual items (row, column) using indexes: Dim i as Integer, j as Integer, ThisRow as Range i = 0 For Each ThisRow in Range("rFactTot").Rows ' Use your If statement to specify the criteria from the row: If ThisRow.Cells(?,?)=? Then i = i + 1 For j = 1 to Range("rFactTot").Columns.Count ListBox1.List(i-1,j-1) Next j End If Next ThisRow -- - K Dales "luthor" wrote: I already posted this question in Excel, bur I think this is a better place: 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 the complete rows which meet the criteria from "rFactTot" I want. Anybody knows the solution?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
avoiding duplicates in listbox (added from another listbox) | Excel Programming | |||
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |