+ Reply to Thread
Results 1 to 12 of 12

ComboBox update help and Textbox population help

  1. #1
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Question ComboBox update help and Textbox population help

    Hi all,

    (NOTE: this is now a seperate query to my previous thread)

    I am (still) trying to create a userform that looks a the selection made by a user from combobox, and then references cells on a data sheet in 8 separate textboxes on the userform.

    So for example: The user selects Project A from the combobox. This selection comes from a range on worksheet A (Live Tracker) called projectTitles. This selection is also mapped to a cell on worksheet B (Data) via the "ControlSource" property of the combobox in VBA (I did this as I saw this method used by someone else and it seemed to work well).

    On the Data worksheet, below the ControlSource mapped cell, are eight cells setup with VLOOKUP to map each development stage that the project has gone through from the Live Tracker worksheet.

    These cells look at the ControlSource value (which reflects the project titles from the combobox on the userform, that range is from the Live Tracker worksheet), and moves across from the project column to each QA (development) stage cell on the Live Tracker worksheet. See below for an example:

    The highlighted column below has the following formulae:

    =VLOOKUP(J1,'Live Tracker'!B9:M182,5,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,6,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,7,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,8,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,9,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,10,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,11,FALSE)
    =VLOOKUP(J1,'Live Tracker'!B9:M182,12,FALSE)

    Project A
    POD QA >>N/A <<
    Playlist QA >>N/A<<
    1st Full QA >>N/A<<
    Fixes 1 >>Complete<<
    Pre-Master >>N/A<<
    Fixes 2 >>N/A<<
    Shipping >>Complete<<
    Test Disc >>TBC<<

    Back on the userform, the eight textboxes located below the combo box will reflect each of these stages populated by the VLOOKUP, using the following (dodgy) code:

    Please Login or Register  to view this content.
    The problem I’m experiencing with this userform is that the text boxes do not instantly reflect the selection the user has made from the drop down. What normally happens is the user needs to select the title from the drop down, and then press enter, and then the textboxes will populate. However, if the user then selects another title, presses enter, the textboxes don’t always update correctly.

    I would really like two things to sort this problem out. Firstly, on selection of the title from the drop down, I’d like the selection to be made without the need for the user to press enter or select the next cell. Secondly, I’d like the textboxes to reflect the user’s selection from the combobox instantly; i.e. with every choice made in the drop down, the textboxes should instantly reflect this QA stages. This will probably be dependent on whether or not the first solution can be made.

    If anyone can help me with these problems, I’d be eternally grateful!!

    Kind regards,

    A Grace
    Last edited by AGrace; 07-06-2010 at 11:09 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: ComboBox update help and Textbox population help

    Can you put code tags around your code, please? Then we can answer you...
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Quote Originally Posted by romperstomper View Post
    Can you put code tags around your code, please? Then we can answer you...
    Sorry, really new to all this VBA stuff. Can you explain what you mean? (FYI - a lot of my code I've pieced together from lots of other peoples queries and solutions)

    UPDATE: Just looked at the forum rules (again), did you mean [code] tag?
    Last edited by AGrace; 07-06-2010 at 07:02 AM.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: ComboBox update help and Textbox population help

    One of the rules for posting on this forum is that if you post code you have to enclose it in code tags - it makes it easier to read. So rather than just typing in your code, you type:
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    and the forum software then displays it as:
    Please Login or Register  to view this content.
    We're not allowed to answer you until you comply.

  5. #5
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Quote Originally Posted by romperstomper View Post
    One of the rules for posting on this forum is that if you post code you have to enclose it in code tags - it makes it easier to read. So rather than just typing in your code, you type:
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    and the forum software then displays it as:
    Please Login or Register  to view this content.
    We're not allowed to answer you until you comply.
    I've already updated the code with those tags. Is there anything else I've missed?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: ComboBox update help and Textbox population help

    Nope, you just hadn't done it when I responded.

    I would suggest you don't use the ControlSource at all (I never do) but instead use the code to write to the cell in question:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Quote Originally Posted by romperstomper View Post
    Nope, you just hadn't done it when I responded.

    I would suggest you don't use the ControlSource at all (I never do) but instead use the code to write to the cell in question:
    Please Login or Register  to view this content.
    That worked BEAUTIFULLY!! I would buy you a beer if i could!

    There is a second query relating to this though that I'd really like to ask, but do I now need to start a new thread as the original request has been solved?

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: ComboBox update help and Textbox population help

    One day, I'm gonna start up Beerpal.com so people really can pay me in beer...
    I'd say post a new question - you can add a link back to this one if it's relevant.

  9. #9
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Quote Originally Posted by romperstomper View Post
    One day, I'm gonna start up Beerpal.com so people really can pay me in beer...
    I'd say post a new question - you can add a link back to this one if it's relevant.
    Thanks Romperstomper!

  10. #10
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Hi Romperstomper,

    There's actually a couple of other things I wanted to check with you:

    One, the userform seems to fall over if the user manually clears the dropbox selection, I presume because the VLOOKUP on the data sheet couldn't feedback a value. In this instance, is there something I can add to that code you provided to blank the textbox when no value is found?

    Two, is it possible to blank the combobox upon closing the userform?

    thanks,

    A Grace

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: ComboBox update help and Textbox population help

    Please Login or Register  to view this content.
    You could (and probably should) also add some error handling to your VLOOKUP formula (using ISNA) so that it returns "" if there is no match or if the cell is blank.
    To clear the cell just use:
    Please Login or Register  to view this content.
    in the Terminate event of the userform.

  12. #12
    Registered User
    Join Date
    06-23-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: ComboBox update help and Textbox population help

    Thanks mate. Works like a charm.

+ 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