+ Reply to Thread
Results 1 to 6 of 6

code for updating rows based on a userform combobox selection

  1. #1
    Registered User
    Join Date
    08-19-2013
    Location
    romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    code for updating rows based on a userform combobox selection

    Hi,
    First of all I appologise if I didn't post this problem correctly, but I'm new to this forum, as well as to excel programming...
    I've created two Excel VBA forms: the first one pops up when the Workbook Opens and gives the possibility to:
    (1) enter a new project, and in this case Page1 from a Multipage of the second form is shown
    and
    (2) update an existing project, wich shows Page2 from the Multipage of the second form.
    Page2 of the second form contains a ComboBox that is populated with the projects allready entered. When a project is selected, data is retreived into the comboboxes and textboxes of the second form (on both pages), permitting the user to update fields.
    My problem resides in the fact that I can't get the form to update an existing record based on the Combobox selection. It only inserts new records, no matter what I do...I've tried various solutions found on the internet, but this being my first vba project, I'm a little overwhelmed by the situation...

    I've attached my workbook, where I've changed the captions of the various objects of the forms.

    Thank you in advance for your time and help!
    Attached Files Attached Files
    Last edited by raluk_ro22; 08-27-2013 at 07:53 AM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: code for updating rows based on a userform combobox selection

    Hi raluk_ro22

    Welcome to the Forum!

    Are the Project ID's Unique...will the SAME Project ID EVER appear more than once in Column B?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    08-19-2013
    Location
    romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: code for updating rows based on a userform combobox selection

    Hi jaslake,
    Thank you!
    The Project ID's are NOT unique. A project id may appear more than once in column B, depending on the Department that works on the project.

    Maybe a glimpse of the code may help:
    Please Login or Register  to view this content.
    Last edited by raluk_ro22; 08-26-2013 at 05:04 AM.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: code for updating rows based on a userform combobox selection

    Hi raluk_ro22

    The Code in the attached has been modified for this
    I can't get the form to update an existing record based on the Combobox selection
    Please note, I've done nothing with the Cell Colors as I have no idea what you're doing or why. Beside that...I'm color blind
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-19-2013
    Location
    romania
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: code for updating rows based on a userform combobox selection

    Hi jaslake,
    Sorry for responding so late... Thank you so much for your help! The code you provided was the answer to my problem. I would never have thought of that solution by myself.
    And don't worry for the Cell Colors I'll work on those later...

    Thank you again!!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: code for updating rows based on a userform combobox selection

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. Change Userform Label based on ComboBox Selection
    By rbyrd023 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-02-2014, 09:25 AM
  2. [SOLVED] Pre populating a userform from excel based on combobox selection
    By michelle 1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2013, 12:09 PM
  3. [SOLVED] Change Labels in Userform based on selection in ComboBox
    By johnw993 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-03-2013, 10:52 PM
  4. [SOLVED] How VB code can unhide/hide rows based on combobox selection?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 01:25 PM
  5. Populating a userform based on a combobox selection
    By blindzero678 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2010, 03:37 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