+ Reply to Thread
Results 1 to 6 of 6

Can't get command button click to trigger cell population

  1. #1
    Registered User
    Join Date
    12-22-2010
    Location
    America
    MS-Off Ver
    Excel 2003
    Posts
    4

    Can't get command button click to trigger cell population

    The idea is that there is a userform which is comprised of two combo boxes. The first combobox fill the second combobox on dropbuttonclick(), and that works just fine. Based on the user's selection the userform then populates several cells, that are used in formulas and then hides the userform. I also need to come up with a line of code to recalculate the values of the formulas. Application.refresh? or .update?

    My major problem is that the cells referenced will not populate when the commandbutton is clicked, but the userform does close so the event is being triggered.

    Please Login or Register  to view this content.
    Last edited by clcs; 12-25-2010 at 01:46 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Can't get command button click to trigger cell population

    Hello clcs,

    Sometimes when updating a UserForm from a worksheet, you need to force the UserForm to redraw to reflect any changes to controls like ComboBoxes and ListBoxes. You can do this with the following command Me.Repaint. If the worksheet needs to updated, you can add DoEvents
    Please Login or Register  to view this content.
    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!)

  3. #3
    Registered User
    Join Date
    12-22-2010
    Location
    America
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Can't get command button click to trigger cell population

    It seems I may not have included enough information because the DoEvents command does not cause the cells to be populated. I've troubleshot this piece for a few hours and just cant seem to get the case command to function properly. I'm not sure if it has some to do with the way combobox2 is filled. This is the code for the entire Userform.

    Please Login or Register  to view this content.
    For background, ComboBox1 determines the array that fills ComboBox2, ComboBox2 is disabled by default, but is enabled after a value is selected from ComboBox1, and ComboBox2 determines the formula and text that fill the rest of the document. The problem is the Case command is not filling the document. TextBox1-4 and ComboBox3 take user imput and populates the date in the ddmmmyy hh:mm format and then closes the UserForm. Both the Date and the UserForm function but the Case command is failing to work as it is intended to. UserForm is opened on the opening of the WorkBook and serves no further purpose after initial population.

  4. #4
    Registered User
    Join Date
    12-22-2010
    Location
    America
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Can't get command button click to trigger cell population

    The only other code involved in the WorkBook is in ThisWorkBook and it properly opens the UserForm when the document is opened. This code all resides in the UserForm module

  5. #5
    Forum Guru 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: Can't get command button click to trigger cell population

    Hi clcs

    The syntax for the second Select Case appears to be incorrect. Try this
    Please Login or Register  to view this content.
    Not tested.

    John
    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.

  6. #6
    Registered User
    Join Date
    12-22-2010
    Location
    America
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Can't get command button click to trigger cell population

    The syntax was the problem. Thank you
    Last edited by clcs; 12-25-2010 at 01:46 AM.

+ 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