+ Reply to Thread
Results 1 to 5 of 5

Form listbox query

  1. #1
    Registered User
    Join Date
    05-31-2007
    Posts
    9

    Form listbox query

    Hi All

    I have a form in my spreadsheet with a listbox in it. The list box is populated via data from another sheet.

    What I would like to be able to do is, when the user brings up the form, I would like certain rows to be pre-selected. The values that I would like to be pre-selected reside on another sheet in column A.

    It may be worth me mentioning that my listbox has 5 columns. The 5th column is a column that has the unique ids of products, which is the column I want to use as the determining factor on which rows I would like preselected.

    I've tried;

    Please Login or Register  to view this content.
    and tried loopingg it to get multiple selections, but this does not work.

    Any ideas would be much appreciated.

    Many thanks
    Oz

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Oz,

    The Selected property returns a boolean value True or False if a row has been selected. You can't use it to select a particular row. This applies to both the Forms style and Control Toolbox ListBox controls.

    Sincerely,
    Leith Ross

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Oz,

    I told you something that isn't really correct. After I looked the property more closely, it isn't a read only. However, The help files don't say how you can't set the property. The method I describe here is undocumented, but works.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    05-31-2007
    Posts
    9
    Thanks very much Leith, I'm using the forms type of listbox but I'm still struggling. With that code, I get an error 'Unable to get Listboxes property of the worksheet class'.

    Not really sure why as I've got the name of the listbox right.

    I've also tried the following code:

    Please Login or Register  to view this content.
    'routesListebox' being my listbox, which gives me the error 'argument not optional'.

    Where do you think I'm going wrong? If I haven't got the option to go down this route, it's not the end of the world and I appreciate you trying anyway

    Oz

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Oz,

    Be sure the List Box is set to Multi. Right click the List Box, select Format Control > Control Tab. Look for the 3 option buttons on the left under Selection Type and click Multi.

    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1