Remembering the data on a userform

  • Hi


    I am using a userform that has several combo boxes, from which the user can select the required data. The following code sets up the userform:


    (Note: Some of the variables are public)



    Every time I load this userform the combo boxes are reset. Is is possible to remember the values that were selected the last time the userform was used? (ie. leave the values in the combo boxes)


    Also, how would I then reset the form, if desired?


    Many thanks to anyone that can help with this.


    Cheers
    Johno

  • Re: Remembering the data on a userform


    Thanks!


    I can store this information on the worksheet, but how can I display those particular values out of the list in the combo box?


    eg.


    Say cboCond was set to "16mm2" on the previous use of the userform. I would like to allow the user to still be able to change this value in the combo box, but have 16mm2 set when the userform is called again.


    So I need the line of code for selecting "16mm2" from the list automatically.


    Many thanks
    Johno

  • Re: Remembering the data on a userform


    Quote from johno359

    So I need the line of code for selecting "16mm2" from the list automatically.


    Many thanks
    Johno


    Assuming the previously selected values are stored in Sheet1, & the value for combo box cboCond was stored in cell A1:


    Code
    cboCond.Value = Worksheets("Sheet1").Cells(1,1)


    Alternately, you could store & load the .Listindex of the currently selected item in the combo box.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!