+ Reply to Thread
Results 1 to 6 of 6

How to get Command Button on UserForm to change color while code processes.

  1. #1
    Registered User
    Join Date
    01-26-2014
    Location
    Orrville, OH
    MS-Off Ver
    Excel 2010
    Posts
    3

    How to get Command Button on UserForm to change color while code processes.

    I have a workbook in which we track daily inspections of our facility. To make the "findings" easier to input, I have a UserForm titled "RecordForm" that opens when requested where all the findings can be input. Once everything is input into the form, you save the record by clicking an add button (the cmdAdd button in the code) and it begins copying all the data to a separate worksheet within the workbook. Once everything is copied, it clears all the entry fields and is ready for the next entry. My problem is that because of the combinations of inspectors, areas, and possible issues they might find, it takes a fair amount of time to copy everything from the userform to the worksheet, but since there is no significant change to the Userform or the Add Button, the user may not realize that it is already working and keep pressing it.

    I'd like to have the "Add Record" button change from the standard gray to red while everything copies and once its done, go back to gray. Unfortunately, everything is copying over to the "Historical Data" worksheet before the button changes color at the very end. So, except for having a colorful button that I don't want at the end, it isn't accomplishing what I want it to do. Here's the code I've tried with the attempt commented out. Is it possible to do what I'm hoping for and if so, what am I doing wrong. I'm a novice with VBA so I try and find someone else's code that does what I want and copy and modify it to work on my workbook. Here's what I've got for this function.

    Please Login or Register  to view this content.
    Last edited by OhioChip83; 02-01-2020 at 12:08 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,100

    Re: How to get Command Button on UserForm to change color while code processes.

    Hello OhioChip83,


    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    01-26-2014
    Location
    Orrville, OH
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How to get Command Button on UserForm to change color while code processes.

    Sorry I wasn't following how to do this when I initially put this in. I'm not a code writer at all. I've done the code tags. Is there anything else that I need to do?

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    12,698

    Re: How to get Command Button on UserForm to change color while code processes.

    Put this at the start of the code
    Please Login or Register  to view this content.
    and then this at the end
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-26-2014
    Location
    Orrville, OH
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: How to get Command Button on UserForm to change color while code processes.

    Haven't been able to get on this for awhile. Plugged in your adds and they worked perfectly. Greatly appreciated.

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    12,698

    Re: How to get Command Button on UserForm to change color while code processes.

    You're welcome & thanks for the feedback

+ 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. Help with code, userform button to change cell font color
    By cybermanager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2020, 02:27 PM
  2. [SOLVED] Change command button color
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2019, 04:19 PM
  3. [SOLVED] Change the color of a command button
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-29-2016, 11:29 AM
  4. [SOLVED] Change the Color of One Command Button with Click of Another
    By Raymundus in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-26-2016, 03:29 PM
  5. [SOLVED] Run Command Prompt Icacls code in VBA Command Button on Userform
    By luismalave in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:40 PM
  6. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  7. Userform Command Button Background Color
    By AaronB in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-19-2012, 01:02 PM

Tags for this Thread

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