Listbox multi selection
"Jorge Rodrigues" wrote in message
...
Hi,
I have a lisbox worksheet based:
John
Mario
Maria
Charles
What I want: mark John and Maria and in contiguos cell appear number 1:
A1 B1
John 1
A3 B3
Maria 1
Not quite sure eactly what you mean. I'm going to guess its:
You have a list of names in a ListBox. Whatever names are selected should
be placed on the sheet in column A, on the row they appear in the listbox.
A 1 should be placed next to them in column B. Which is:
assuming your listbox is called MyList and your worksheet is called
MySheet:
dim r as long
for r = 1 to MyList.ListCount - 1
if MyList.Selected( r) then
Sheets("MySheet").Cells( r, 1).Value = MyList.List(r)
Sheets("MySheet").Cells( r, 2).Value = 1
endif
next
Iain King
|