+ Reply to Thread
Results 1 to 6 of 6

ActiveX ListBoxes not saving data

  1. #1
    Registered User
    Join Date
    11-05-2010
    Location
    Over, There
    MS-Off Ver
    Excel 2016
    Posts
    44

    ActiveX ListBoxes not saving data

    I have an excel sheet with 4 ActiveX listboxes, I have 4 buttons for each list to add an item to each of the lists. The data is added to the list and is displayed properly, but when I save then re-open the file the lists are empty. I tested this with a new file with 1 list box and 1 button that adds an item to the list and it does the same thing. Is there a reason the lists are blank? I know I can have the list be loaded from a separate sheet every time the file is open but that completely defeats the purpose of having the listbox in the first place.

    Here is my test listbox code:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: ActiveX ListBoxes not saving data

    Paste this in the workbook module

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    11-05-2010
    Location
    Over, There
    MS-Off Ver
    Excel 2016
    Posts
    44

    Re: ActiveX ListBoxes not saving data

    Sarcasm?

    In my other Excel sheet the user enters two values, and each value goes into one of the columns so I can't do that.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: ActiveX ListBoxes not saving data

    The values must be stored somewhere e.g. on a sheet. You can't just add them to the listBox & expect them to stay there
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  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,259

    Re: ActiveX ListBoxes not saving data

    Hello Demon4321,

    If the only information the ListBox contains is from these buttons why does it need to be saved?
    If the ListBox contains other information, where is it loaded from?
    If the buttons are always adding the same data to the ListBox, how do you prevent duplicates or do you?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: ActiveX ListBoxes not saving data

    No, actually it wasn't.

    And what is the point of using a button to load a listbox? Why not use dynamic ranges and refer to them?

+ 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