Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox multi selection
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 Thanks in advance Jorge |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox multi selection
Hi, Iain:
Thanks for your help. However, the problem is that the names are in the sheet, I mean from B10:B50 and the ListBox source is from B10:B50. So the only thing that I want is to choose a name from this list, for example B15 (Jorge) and as I click in that name, it appears in C15 the number 1 and so on if I click in other names in List. I don't know if I could explain right away, excuse me, please. Can you be so kind in order to help me again? I thank you in advance. Jorge "Iain King" escreveu na mensagem ... "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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox multi selection
Hi again!
Never mind Iain! I found out what was the problem and now is solved with a little modifying of your hint: Dim r As Long For r = 1 To ListBox1.ListCount - 1 If ListBox1.Selected(r) Then Sheets("List_Grat").Cells((r + 10), 5).Value = 1 End If Next "Jorge Rodrigues" escreveu na mensagem ... Hi, Iain: Thanks for your help. However, the problem is that the names are in the sheet, I mean from B10:B50 and the ListBox source is from B10:B50. So the only thing that I want is to choose a name from this list, for example B15 (Jorge) and as I click in that name, it appears in C15 the number 1 and so on if I click in other names in List. I don't know if I could explain right away, excuse me, please. Can you be so kind in order to help me again? I thank you in advance. Jorge "Iain King" escreveu na mensagem ... "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multi-field listbox in an Excel form | Excel Discussion (Misc queries) | |||
multi select listbox | Excel Programming | |||
populating a multi-column Listbox | Excel Programming | |||
populating a multi-column Listbox | Excel Programming | |||
Multi-columns in a ListBox | Excel Programming |