+ Reply to Thread
Results 1 to 5 of 5

enter data automatically in userform depending on dropdown selection

  1. #1
    Registered User
    Join Date
    07-12-2010
    Location
    Guernsey
    MS-Off Ver
    Excel 2007
    Posts
    26

    Unhappy enter data automatically in userform depending on dropdown selection

    Hi,
    Right now I have a form that automatically generates a unique ascending number in a text box for each new entry. Ideally I would like it to be a combobox that lists all the previous record numbers as well as generating the new one so that if a previous record number is selected it will automatically enter the relevant information from that previous record into certain boxes on the form.
    e.g say I want to go back to journey 00003. I select it from the dropdown list and it enters, among other things, the date of that journey and the destination into the relevant boxes.
    TIA!

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: enter data automatically in userform depending on dropdown selection

    We would need a lot more information (preferably a sample workbook) to provide meaningful code, but I would suggest you don't combine the two fields, but rather add a combobox to the top of your form to allow searching. You can populate this directly from the ID column of your worksheet and then probably just use its ListIndex property to get the relevant row number.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    07-08-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: enter data automatically in userform depending on dropdown selection

    Quote Originally Posted by ImboJones View Post
    e.g say I want to go back to journey 00003. I select it from the dropdown list and it enters, among other things, the date of that journey and the destination into the relevant boxes.
    TIA!
    I'm actually trying to do something similar, but I cannot figure out how to write the code for the combobox to do this. Could you please help?

    thank you!

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: enter data automatically in userform depending on dropdown selection

    Please start your own question rather than hijacking this unsolved one.

  5. #5
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: enter data automatically in userform depending on dropdown selection

    Hi ImboJones;

    You put a Cell Link in the combo box and assign a macro to the combo box. Make sure that the 1st item in the list is "NEW #".
    In the macro you check the Cell Link, it gives you the row # of the selected item. If the row # is 1 then generate your new #, if the row # is greater than 1 then the # selected should be 1 less than the row # (as long as there aren't any missing), or just take the value of the row # in the list. Then you should be able to populate your form accordingly.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

+ 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