Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default multi select listbox

Hi All,
In the line of code below I am trying to insert the checked items from
the multiselect-extended listbox into a1 and add next checked items to
the right. Its only copying the last item selected and placing it in
"IV1".
I cannot seem to get this to work.

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
range("A1").Select
ActiveCell.Offset(0, 1).Value = Me.ListBox1.list(i)
End If
Next i



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default multi select listbox

I don't see anything that would write to IV1, but you are writing everything
to B1, so you would see only the last item in B1:

j = 0
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
range("A1").Offset(0, j).Value = Me.ListBox1.list(i)
j = j + 1
End If
Next i


"Paul Mueller" wrote in message
...
Hi All,
In the line of code below I am trying to insert the checked items from
the multiselect-extended listbox into a1 and add next checked items to
the right. Its only copying the last item selected and placing it in
"IV1".
I cannot seem to get this to work.

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
range("A1").Select
ActiveCell.Offset(0, 1).Value = Me.ListBox1.list(i)
End If
Next i



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default multi select listbox

Paul,

Try this

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
j=j+1
Cells(1,j).Value = Me.ListBox1.list(i)
End If
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Paul Mueller" wrote in message
...
Hi All,
In the line of code below I am trying to insert the checked items from
the multiselect-extended listbox into a1 and add next checked items to
the right. Its only copying the last item selected and placing it in
"IV1".
I cannot seem to get this to work.

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
range("A1").Select
ActiveCell.Offset(0, 1).Value = Me.ListBox1.list(i)
End If
Next i



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-field listbox in an Excel form Lee S. Excel Discussion (Misc queries) 0 September 14th 06 10:19 PM
populating a multi-column Listbox Tom Ogilvy Excel Programming 3 April 26th 04 08:26 PM
populating a multi-column Listbox Harald Staff Excel Programming 1 April 26th 04 08:26 PM
Multi-columns in a ListBox Tom Atkisson Excel Programming 1 October 5th 03 10:27 PM
Extract values from a multi-select multi-column list-box Peter[_20_] Excel Programming 5 September 28th 03 04:04 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"