excel - what's the meaning of listcount -1 -
i've been searching on internet trying find meaning of listcount -1 is, can't seem find exact answer.
why there -1 beside listcount? or .list(.listcount -1,1) mean?
edit
example of listcount
.additem a.value
.list(.listcount -1, 1) = ws.cells(a,b).value
this adds value of ws.cells(a,b) listbox1 don't understand why/how?
or found code on internet http://www.ozgrid.com/vba/multi-select-listbox.htm
i understand purpose of code "if 1 of list selected, transfer value of listbox cells" why there .listbox1.listcount -1?
to make things clearer, i've said, listcount starts @ 1 when counting listbox items or list.
listbox indexing of items or list starts @ 0. in example, trying add item or list in multi-column listbox.
take @ below example:
with me.listbox1 .add "item1" .list(.listcount - 1, 1) = "item2" .list(.listcount - 1, 2) = "item3" end above code populates listbox set 3 columns.
line .add "item" adds first list in listbox.
need populate rest of columns.
access columns, use .list property syntax:
expression.list(pvargindex, pvargcolumn) pvargindex listbox listindex , pvargcolumns column number.
remember added 1 item using .add property , listindex of item is?
.listcount - 1 'which current item count in listbox less 1 equal 0 to learn more pupulating listbox, check this out.
see here.
hope above helps somehow.
Comments
Post a Comment