+ Reply to Thread
Results 1 to 8 of 8

have macro that assigns text to column, need to paint the background with different colors

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    have macro that assigns text to column, need to paint the background with different colors

    i have the following macro, it puts the text Balanced or Out of Balance in a cell on the sheet. If its balanced, i want the background color to be Green, otherwise it needs to be Red. here's the code:

    Please Login or Register  to view this content.
    Can anyone help me out with this?

  2. #2
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have macro that assigns text to column, need to paint the background with different co

    i have this code inside a macro that when it finishes, it paints the background. was just wondering if there is a way to do this on the IF statement above

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have macro that assigns text to column, need to paint the background with different co

    thoughts anyone?

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: have macro that assigns text to column, need to paint the background with different co

    Not sure I undrestand your problem properly but perhaps

    Please Login or Register  to view this content.
    Alf

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have macro that assigns text to column, need to paint the background with different co

    thanks but i was wondering if I could do this in an IF statement below and not a sub??

    =IF(R1=R3,"Balanced","Out of Balance")

    i have it on good authority that i cannot change a cells color using the formula above. thanks for all your help.
    Last edited by dmcgov; 03-15-2016 at 07:35 AM.

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: have macro that assigns text to column, need to paint the background with different co

    i cannot change a cells color using the formula above
    Well yes and no, if you pair the if statement with a conditional format you can get this to work.

    Assuming that the if statement is placed in cell R5, first select R5. Then click on "Conditional Formatting" ("Home" tab) and click "New Rule", then select "Use formula to determin witch cell to formate"

    (Don't forget R5 must be selected!).

    In the window that opends beneath the line "Formate values ........" write
    Please Login or Register  to view this content.
    then click "Formate" and select tab "Fill" then select "green" and click ok.

    Then you need a rule for the case R1 is not like R3. Same procedure as earlier but this time write formula

    Please Login or Register  to view this content.
    and select red as fill color.

    Alf

    Ps Thanks for feedback and rep and hopefully I've now deserved the rep you gave me on my first attemp

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: have macro that assigns text to column, need to paint the background with different co

    thanks alf, i was already there. didnt know i could enter in the formula, i was doing the formatting based on text values.

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: have macro that assigns text to column, need to paint the background with different co

    Then I think we both learned something as I was not aware that I could get the same result based on text.

    Alf

+ 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] Conditional formulas based on Cell's background and text colors
    By Taisir in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-28-2015, 05:13 AM
  2. Conditional formulas based on Cell's background and text colors
    By Taisir in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-28-2015, 02:13 AM
  3. Background color of cell based on colors in column
    By mez275 in forum Excel General
    Replies: 1
    Last Post: 09-28-2013, 05:06 PM
  4. search for a given number and paint the cells in colors
    By Antonio Rosales in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 01-29-2013, 10:59 AM
  5. Looking for macro that assigns codes.
    By dpbooth in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2012, 09:00 AM
  6. if blank cells, paint yellow. if cell to left is less than a number, don't paint
    By curbster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2009, 02:40 AM
  7. [SOLVED] how to paint different colors in a graph?
    By Ajaya Pandey in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-15-2006, 06:10 AM

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