+ Reply to Thread
Results 1 to 9 of 9

Active X drop down list - always return to the item in the list that was selected.

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Active X drop down list - always return to the item in the list that was selected.

    I have an Active X drop-down list control in a sheet named "DashBoard". The List box has approx. 100 items in the list. If I am on item 25 in the list, when I return to DashBoard, I would like it to go back to item 25 but am not sure how to do this?

    Please Login or Register  to view this content.
    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Active X drop down list - always return to the item in the list that was selected.

    Setting ListIndex to 1 resets the selection so remove that line.

    Depending on your requirements, the default selection is -1 (nothing selected) so you may needed to add code to select the first item or you could set the Style property to DropdownList but that will prevent the user typing in the text portion of the control.

  3. #3
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Active X drop down list - always return to the item in the list that was selected.

    Thank you for your reply. I removed the ListIndex line but that did not help? There is no Style property available in Active X? When I work in the DashBoard, I might be on item 47 & I then click a button that takes me to another sheet to view detail. On that sheet, I have a "Return" button. I am trying to return to the item number (47) I was viewing in the DashBoard, if possible?
    Thanks in advance

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Active X drop down list - always return to the item in the list that was selected.

    Perhaps the Style property is one of those not available on an ActiveX control placed on a worksheet... Can't check at the moment as using a phone but I'll check later if no one else comes in on this.

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Active X drop down list - always return to the item in the list that was selected.

    Curious...

    I have an Active X drop-down list control...
    With .ListBox1...

    A Dropdown list is a ComboBox (Default control name 'ComboBox1'), this is not the same thing as a ListBox. A ListBox does not have a Style property while a ComboBox does. So which do you have? I'd guess a ListBox as Style is missing and the code must refer to a valid control.

    Whichever, both controls have a ListIndex property. This is used to get or set the current selected/highlighted item. The line
    Please Login or Register  to view this content.
    resets the ListIndex to 1 every time the code executes so just remove/comment that line.
    Last edited by cytop; 02-14-2017 at 06:26 AM.

  6. #6
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Active X drop down list - always return to the item in the list that was selected.

    I have a ListBox - I did remove that line but it does not return to the correct line item? Is there a way , I can store the list index number when I leave the sheet and then return to that number?

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Active X drop down list - always return to the item in the list that was selected.

    The ListIndex will only change when another item is selected by the user (or code) or the list is reset/changed. Are you sure no other code is interacting with this?

    Perhaps it would be an idea t upload a sample of your workbook that displays the issue.

  8. #8
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Active X drop down list - always return to the item in the list that was selected.

    I created a test workbook with same code & it worked perfectly. In the "live" workbook, I select item 27 and move to another sheet. If I manually click on the "DashBoard" sheet, item 27 is still selected. When I use code to move to DashBoard sheet, the item list changes - I have simplified the code but it still changes the list selection:
    Please Login or Register  to view this content.
    If I click manually on the sheet tab, it works?

  9. #9
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Active X drop down list - always return to the item in the list that was selected.

    Thanks for help & advice. I created a test file which worked as I expected? In the "live" file, it still does not revert to the correct item number but it is not a major issue so I will re-look when I have some time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Data fill to another cell based on the item selected from drop down list
    By Hussain Anees in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2016, 01:08 PM
  2. Display multiple value when item selected in drop down list
    By peter.lu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2015, 05:06 PM
  3. Replies: 1
    Last Post: 08-13-2015, 11:57 AM
  4. Macro delete submit button when item selected from drop dowm list
    By vnoelte in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-05-2014, 12:33 PM
  5. Run macro when item from drop-down list is selected
    By barnett2000 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-09-2013, 12:52 PM
  6. How to get index of selected item in drop down list?
    By nleahcim in forum Excel General
    Replies: 3
    Last Post: 08-08-2011, 02:08 PM
  7. Replies: 1
    Last Post: 05-18-2010, 07:36 PM

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