+ Reply to Thread
Results 1 to 2 of 2

Listbox selected item un-highlights when moving to another pat of the form

  1. #1
    Registered User
    Join Date
    12-04-2017
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    16

    Listbox selected item un-highlights when moving to another pat of the form

    Hi, I have a bit of a weird situation with a userform I have built. The form has numerous Listboxes that have row sources that are linked to dynamic named ranges and all works expected apart from two.

    I have a 'fromdate' list box and a'todate' listbox and when I select a date from the list in the todate listbox the previously selected fromdate selection un-selects and the list returns to the top index value of zero (despite setting the top index to a different value in the firm initialize module).

    I have checked my code and there are no 'change' triggers on these boxes and the click action just moves values into a worksheet.

    I'm completely baffled and couldn't find a single reference to anything similar despite repeated Google searching.

    I'm just hoping one of you guys can think of anything that might be causing this?

    Thanks and sorry for the long winded post.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Listbox selected item un-highlights when moving to another pat of the form

    Something in the userform code is triggering what you describe.
    It could be UserForm_Activate

    Initialize fires when the form is actually loaded into memory - so this only fires ONCE
    Activate fires whenever userform is shown -if you hide then show a form Activate event will fire AGAIN

    Code below defaults To & From listboxes to 1st item in list and would do exactly what you describe when userform is hidden
    Please Login or Register  to view this content.
    Moving the code to UserForm_Initialize eliminates the problem

    If you are still no further forward, post the complete userform code

    Pease use code tags around your code
    - click the # icon
    - and
    [CODE] paste your code here [ /CODE]
    Last edited by kev_; 02-15-2018 at 04:39 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

+ 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. [SOLVED] Do something for each selected item in a listbox
    By stojko89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-16-2017, 06:38 AM
  2. Filter using Listbox selected item(s)
    By dgbunny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2016, 09:17 AM
  3. Get the name of a listbox where an item is selected
    By Jerbinator in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-22-2016, 03:16 PM
  4. Listbox item Highlighted but not Selected
    By shawnvw in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2015, 05:29 PM
  5. Selected item in first listbox.
    By waka in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-09-2015, 11:45 PM
  6. [SOLVED] Macro to run when item is selected from listbox
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2014, 09:58 PM
  7. [SOLVED] Macro for moving selected item to new form
    By Farrar in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-03-2013, 06:43 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