Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default multicolumn listbox move or value set

Hi,
In a multicolumn listbox excel userform is it possible to a)
initialize a listbox with one/several of the options already selected
as default and b) insert new items between pre-existing items (maybe
with AddItems followed by a move type command) ?

Thanks,
Andrew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default multicolumn listbox move or value set

additem has a second argument stating location. It inserts the new value at
that point, so higher ordered items are moved up automatically. Here is an
example that populates a listbox with 0, 2, 4 and then inserts 3 and 1 so
the result is 0, 1, 2, 3, 4. It also then selects 0 and 3

Private Sub CommandButton1_Click()
ListBox2.Clear
ListBox2.MultiSelect = fmMultiSelectMulti
For i = 0 To 4 Step 2
ListBox2.AddItem i
Next
j = 3
For i = 2 To 1 Step -1
ListBox2.AddItem j, i
j = j - 2
Next
For i = 0 To ListBox2.ListCount - 1
If i Mod 3 = 0 Then
ListBox2.Selected(i) = True
End If
Next

--
Regards,
Tom Ogilvy



"Andrew Smith" wrote in message
om...
Hi,
In a multicolumn listbox excel userform is it possible to a)
initialize a listbox with one/several of the options already selected
as default and b) insert new items between pre-existing items (maybe
with AddItems followed by a move type command) ?

Thanks,
Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default multicolumn listbox move or value set

Thanks so much! You have been extremely helpful, do you work for this
site?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default multicolumn listbox move or value set

No, this is peer to peer support. Occasionally a Microsoft employee will
post, but they are usually clearly identied with [MSFT] or [MS] as part of
their from name. So most of the people here are sharing their experiences
and knowledge.

--
Regards,
Tom Ogilvy

"Andrew Smith" wrote in message
...
Thanks so much! You have been extremely helpful, do you work for this
site?


*** Sent via Developersdex http://www.developersdex.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
Reordering with Multicolumn Listbox asmenut Excel Programming 2 August 17th 04 01:53 PM
Multicolumn Listbox and ordinary listbox Ron_D Excel Programming 0 June 4th 04 08:56 PM
Adding Header to multicolumn ListBox Wellie[_2_] Excel Programming 1 February 19th 04 10:31 AM
multicolumn Listbox and textalignment John Holland Excel Programming 3 September 11th 03 01:45 AM
Values in a MultiColumn Listbox Tom Ogilvy Excel Programming 5 September 5th 03 08:30 PM


All times are GMT +1. The time now is 07:49 AM.

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"