vba - Excel multi-select, multi-column listboxes -
i having trouble coding userform takes selected data 1 multi-column listbox , adds listbox on same userfrom. after adding, data removed source listbox
"listbox" data located, , "listbox1" being added to.
private sub add_click() = 0 listbox.listcount - 1 if listbox.selected(i) = true nextempty = listbox1.listcount listbox1.list(nextempty, 0) = listbox.list(i, 0) listbox1.list(nextempty, 1) = listbox.list(i, 1) listbox1.list(nextempty, 2) = listbox.list(i, 2) listbox.removeitem (i) end if next end sub this code gives me run-time error '381' "could not set list property. invalid property array index." have done looking around can't seem pinpoint how use these properties correctly. appreciated.
you cannot set value index greater maximum in list (and maximum listcount (or listcount-1 if 0 based).
so, must add values listbox1.add
Comments
Post a Comment