+ Reply to Thread
Results 1 to 12 of 12

HOW to change the color button based on changing any of the cells value

  1. #1
    Registered User
    Join Date
    11-15-2020
    Location
    QATAR
    MS-Off Ver
    2019
    Posts
    5

    Question HOW to change the color button based on changing any of the cells value

    i want to change the color of the button on the user form based on changing any of the cells value in column E
    SHEET2 , column E

    For example
    This is what I wrote

    Please Login or Register  to view this content.
    But it doesn't work
    Please help with this
    Attached Files Attached Files
    Last edited by MOHAMED121212; 11-15-2020 at 10:56 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: HOW to change the color button based on changing any of the cells value

    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. You are new here, so I have done it for you today.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: HOW to change the color button based on changing any of the cells value

    Welcome to the forum
    Attach a copy of your workbook so that we are able to see the complete context that you wish to solve.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  4. #4
    Registered User
    Join Date
    11-15-2020
    Location
    QATAR
    MS-Off Ver
    2019
    Posts
    5

    Re: HOW to change the color button based on changing any of the cells value

    I don't know how to attach my workbook

    I have attached the code for the operation with an explanation of what I want

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: HOW to change the color button based on changing any of the cells value

    Rather than spend time with dozens of questions and answers using crystal ball gazing.
    Help us to help you - there is a big yellow banner at the head of the page explaining how to upload your workbook.
    With your workbook the answer would become obvious what you have done wrong and you will get a far speedier resolution.
    torachan.

  6. #6
    Registered User
    Join Date
    11-15-2020
    Location
    QATAR
    MS-Off Ver
    2019
    Posts
    5

    Re: HOW to change the color button based on changing any of the cells value

    hey i have uploaded the file
    Attached Files Attached Files

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: HOW to change the color button based on changing any of the cells value

    I have placed code in the sheet module
    I have difficulty envisaging a use for this action
    the form must be present and active also show module = false to enable you to put values into column "E"
    torachan.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: HOW to change the color button based on changing any of the cells value

    Hi Mohamed

    In the attached file, I simplified your request.

    Does this help you??

    If not, please ask again..

    zeddy
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: HOW to change the color button based on changing any of the cells value

    I took too long drinking my tea, torachan was quicker!

    zeddy
    Excel Tactical Beverages Unit

  10. #10
    Registered User
    Join Date
    11-15-2020
    Location
    QATAR
    MS-Off Ver
    2019
    Posts
    5

    Re: HOW to change the color button based on changing any of the cells value

    Quote Originally Posted by torachan View Post
    I have placed code in the sheet module
    I have difficulty envisaging a use for this action
    the form must be present and active also show module = false to enable you to put values into column "E"
    torachan.

    Torachan
    Really, thank you very much for your help, but there is a slight modification that I want from you, please
    I want to change the button color in the user form based on changing any of the cells in column E, and column f in the same row
    I know that I ask a lot, but I made a mistake in my first request and did not write everything I wanted
    Finally, thank you for your patience.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-15-2020
    Location
    QATAR
    MS-Off Ver
    2019
    Posts
    5

    Re: HOW to change the color button based on changing any of the cells value

    Quote Originally Posted by zzzeddy View Post
    Hi Mohamed

    In the attached file, I simplified your request.

    Does this help you??

    If not, please ask again..

    zeddy

    zeddy
    Thank you for the nice simplification
    but there is a slight modification that I want from you, please
    I want to change the button color in the user form based on changing any of the cells in column E, and column f in the same row
    Torachan wrote it in code without COUNTIF
    I want it from you in the same way as you, in order to learn the two methods from you and from Torachan
    Finally, thank you for your patience.
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    08-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2007, 2010, 2013, 2016, Office 365
    Posts
    467

    Re: HOW to change the color button based on changing any of the cells value

    Hi Mohamed

    OK, have a look at this updated attached version v1b.

    The conditions I have chosen are:
    column E has a value 1 entered somewhere, and the cell in column F, on the same row, has "cat" entered.
    If both these conditions are met (anywhere within columns E and F), then your button colour is set as required.

    NOTE: I only check for the FIRST value of 1 in column E, and its corresponding adjacent entry!
    If there are multiple entries of 1 in column E, then the code would need adjusting, to check every 'pair' of values etc etc etc

    zeddy
    Attached Files Attached Files
    Last edited by zzzeddy; 11-15-2020 at 04:53 PM.

+ 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. [SOLVED] Color changing: change the color of one cell, and have other cells change colors too
    By hadydea in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2019, 04:51 PM
  2. Change color of macro button based on cell value
    By JayUSA in forum Excel General
    Replies: 3
    Last Post: 05-18-2017, 04:05 AM
  3. Help changing color of cells on button click
    By LePig in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 08-26-2016, 10:03 AM
  4. Need help changing cell color based on percentage change
    By mnhim001 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-22-2015, 05:24 PM
  5. Replies: 3
    Last Post: 08-18-2014, 12:47 PM
  6. Changing font color based on change from previous value
    By dgtvr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-18-2008, 04:25 PM
  7. Changing cells color without clicking command button
    By grumpyguppy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-19-2008, 03:22 AM

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