Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How do I change the state of an item in a (form) multiselect list box

I have a multiselect list box in a form that I need to use to
manipulate some other data. I have already defeated the problem of
getting useful data out of the list box. The problem is that when the
form with the list box is loaded, it populates the list box from
scratch. How can I make the code select a specific entry?
Listname.List(i).Select does not work.

I can properly identify every list item that is being added and know
its position in the list (as well as a reference cell that indicates
if it should be selected). I just can't figure out how to select the
appropriate items.

Help would be greatly appreciated! Thanks!

Brian

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do I change the state of an item in a (form) multiselect list box

Hi Brian,

Try usuing the ListBox's ListIndex property, the first item
is item 0, the second is item 1.

For example, to select the fourth item, try something like:

'=============
Private Sub UserForm_Initialize()
With Me.ListBox1
.ColumnCount = 4
.List = Range("A1:D20").Value
.ListIndex = 3
End With
End Sub
'<<=============

---
Regards,
Norman


wrote in message
ups.com...
I have a multiselect list box in a form that I need to use to
manipulate some other data. I have already defeated the problem of
getting useful data out of the list box. The problem is that when the
form with the list box is loaded, it populates the list box from
scratch. How can I make the code select a specific entry?
Listname.List(i).Select does not work.

I can properly identify every list item that is being added and know
its position in the list (as well as a reference cell that indicates
if it should be selected). I just can't figure out how to select the
appropriate items.

Help would be greatly appreciated! Thanks!

Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How do I change the state of an item in a (form) multiselect list

I'm not sure what you are after but:

ListBox1.Value = ListBox1.ListIndex(YourIndexNumber)

This should return the value of whichever index number you put in the
parentheses.

" wrote:

I have a multiselect list box in a form that I need to use to
manipulate some other data. I have already defeated the problem of
getting useful data out of the list box. The problem is that when the
form with the list box is loaded, it populates the list box from
scratch. How can I make the code select a specific entry?
Listname.List(i).Select does not work.

I can properly identify every list item that is being added and know
its position in the list (as well as a reference cell that indicates
if it should be selected). I just can't figure out how to select the
appropriate items.

Help would be greatly appreciated! Thanks!

Brian


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
Recording a macro to change item selected in drop down list Jen Excel Worksheet Functions 2 October 2nd 08 11:37 PM
How can I choose more than one item from list in a form in Excel? Jolly Excel Worksheet Functions 7 July 14th 08 06:28 PM
How to link macro to change an item in drop-down list Amotif Excel Discussion (Misc queries) 1 May 7th 08 01:55 PM
Multiselect Listbox - identify if item picked apndas[_12_] Excel Programming 5 July 27th 06 03:23 AM
List Box Multiselect Form ann_nyc Excel Programming 5 October 12th 05 07:03 PM


All times are GMT +1. The time now is 10:32 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"