Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TK TK is offline
external usenet poster
 
Posts: 177
Default select mulitiple columns and items from a listbox

Hi:

The code below works for returning selected items
in a multiple select ListBox.

What Im trying to do (without much success) is modify the
code to select multiple items and multiple columns.

Any help or examples will be greatly appreciated.

Private Sub CommandButton1_Click()

For x = 0 To ListBox1.ListCount - 1

If ListBox1.Selected(x) = True Then
ActiveCell.Value = UserForm2.ListBox1.List(x)

End If
Next x

End Sub


Thanks TK


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default select mulitiple columns and items from a listbox

You can't select individual columns

Private Sub CommandButton1_Click()
Dim x as Long

For x = 0 To ListBox1.ListCount - 1
if x mod 2 = 0 then
ListBox1.Selected(x) = True
end if
Next x

End Sub

selects every other row. The multiselect property should be set to true.

--
Regards,
Tom Ogilvy



"TK" wrote in message
...
Hi:

The code below works for returning selected items
in a multiple select ListBox.

What I'm trying to do (without much success) is modify the
code to select multiple items and multiple columns.

Any help or examples will be greatly appreciated.

Private Sub CommandButton1_Click()

For x = 0 To ListBox1.ListCount - 1

If ListBox1.Selected(x) = True Then
ActiveCell.Value = UserForm2.ListBox1.List(x)

End If
Next x

End Sub


Thanks TK




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
Select Multiple Items and return value for Dropdown or listbox kookie Excel Discussion (Misc queries) 4 January 19th 09 10:18 PM
Adding items to columns in a listbox Daniel Bonallack Excel Discussion (Misc queries) 1 May 7th 07 04:45 PM
Problem using INDEX to select items in listbox Shazbot Excel Discussion (Misc queries) 3 April 28th 06 09:06 AM
Selecting multiple items and columns from ListBox TK Excel Programming 0 August 25th 04 01:19 AM
SELECT, ERASE, EDIT items in listbox unplugs[_29_] Excel Programming 10 June 30th 04 04:56 AM


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

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

About Us

"It's about Microsoft Excel"