Can somebody help me with...


Posted by Alexandre Popov on June 21, 2000 5:02 AM

I have one big problem. Please, help me.

The problem is:
I have the data on the Worksheet “Clients” (for example), Range A1:F8 (each row contains unique data).

1/ I need ListBox with multi select possibility, filled with this data (by rows). This is not a problem, but can ListBox contains the data from 8 colomns?

2/ Depending on selected in ListBox items, I need to copy and insert the data from Worksheet “Clients” to Worksheet “INVOICE”(from the same workbook) between row 7 and row 8, because rows from the 8th to 18th contain important information (the number of inserted rows depending on the number of the selected items, certainly).

3/ Next time when I need to select data from the ListBox, the data inserted before must disappear on the Worksheet “INVOICE” (row 8 follows row 7 without inserted before rows).

I'll be appreciate for any information of how to solve this problem. A.Popov ( Russia,Moscow )



Posted by Ivan Moala on June 21, 0100 11:57 PM


Hi Alexandre
1) Try using the Listbox from the Control toolbox
which is an Activex control.
Right click on the listbox and select Properties
The properties you are after are;
i) Columncount = 8
ii) Listfillrange = A1:F8
iii) Multiselect = 1 frmmultiselectmulti

Note: also Columnwidths - suggest you experiment with
different pt sizes, try 40 pt;40 pt;40 pt;40 pt;40 pt;40 pt;35 pt;35 pt

2) For your code you may have to experiment

code to copy selected row try;
Range(Cells(ListBox1.ListIndex + 1, 1), Cells(ListBox1.ListIndex + 1, 6)).Copy

For multiselectable listboxes to get the relevant
selected item you have to use the
ListBox1.Select method, this will be True if selected.
Also note the the indexing starts @ 0 NOT 1

HTH

Ivan