+ Reply to Thread
Results 1 to 15 of 15

background color

  1. #1
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    background color

    Hi. I would like a cell to be either "green2 or "red" depending on 2 other cell that are dates. Example if there are dates inserted on A1 and B1 than C1 is green but if there is only a date inserted on A1 (B1 is blank) than C1 is red...
    Can it be done?
    Thanks

  2. #2
    Registered User
    Join Date
    12-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    88

    Re: background color

    Use conditional formatting on C1 and make 2 rules. RED rule using a formula
    Please Login or Register  to view this content.
    GREEN rule using formula
    Please Login or Register  to view this content.
    then copy it down column C

  3. #3
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    Thanks. That, almost works. Had to put the red rule also >0 ( =$B1>0 insted =$B1=0), and works like a charm. Is there an easy way of making a column work all "like that" meaning Cn depending of An and Bn? Or have to make "new" rule to every cell? I just have to make like...100 rules

  4. #4
    Registered User
    Join Date
    12-20-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    88
    Quote Originally Posted by jlavado View Post
    Thanks. That, almost works. Had to put the red rule also >0 ( =$B1>0 insted =$B1=0), and works like a charm. Is there an easy way of making a column work all "like that" meaning Cn depending of An and Bn? Or have to make "new" rule to every cell? I just have to make like...100 rules
    If you remove the $ you should be able to copy across the sheet. The $ is a absolute reference that holds it in column B

  5. #5
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    You're a miracle worker
    Thanks. Works just fine
    Lot of work saved

  6. #6
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    Hi all again
    Another question(s):
    - I need C1 to be blank if either A1 and C1 are blank, C1 Red if A1 is with a date but if both A1 and C1 are with a date than C1 is Green
    - Can I make the sheet (Those chosen from bottom) a color filled depending on, lets say, the above C1? Or if there is any color filled cell?
    Last edited by jlavado; 12-11-2020 at 07:16 AM.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: background color

    Hello jlavado and Welcome to Excel Forum.
    Your first point seems to have a contradiction. If only A1 has a date then that seems to mean that C1 is empty so that would satisfy the condition for both no fill or red fill.
    As far as green fill, because Excel uses the number of days since Dec 31, 1899 to assign dates, try: =AND(ISNUMBER(A1),ISNUMBER(C1))
    I don't understand the second request. Perhaps utilizing the instructions in the banner at the top of the page and supplying an .xlsx file as a manually highlighted example which we could attempt to automate work may help.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  8. #8
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    Hi.
    As for the 1st issue, I was able to solve it, by using some different logic than I was doing, and some priorities.
    As for the 2nd issue, the idea is if the status is red (see Ex1 Red.jpg in attachments) than the below page descrition is red,
    if the status is green (see Ex2 Green.jpg in attachments) than the below page descrition is green.
    Trying my best to describe this, as English is not mother language, and Excel is not my strong...
    Attached Images Attached Images

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,557

    Re: background color

    I believe that conditionally coloring the worksheet tab requires VBA, of which I know very little.
    I will ask some of the VBA forum contributors to take a look at this thread.
    I still suggest uploading an .xlsx file rather than screen shots as screen shots can't be used for testing code.
    The VBA contributors will probably need to know the logic that causes some cells in the worksheet to be colored red and others green.
    I hope that you have a blessed day.

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: background color

    The VBA contributors will probably need to know the logic that causes some cells in the worksheet to be colored red and others green.


    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to "Post Quick Reply" button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  11. #11
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    Hi
    If really needed to upload the .xlsx file, I will, but because this is some work being done to a company, I rather prefer trying without uploading them...but if there's no other way...

  12. #12
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: background color

    Hi there,

    I haven't tried to get to grips with the logic of your conditional formatting process, but see if the attached workbook gets you moving in the right direction.

    If any cell in the range F1:J1 has a red background due to conditional formatting, the sheet tab will be coloured red.

    If no cell in the range F1:J1 has a red background due to conditional formatting, the sheet tab will be coloured green.

    The following code is used in the VBA CodeModule of the worksheet under test:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files
    Last edited by Greg M; 12-21-2020 at 03:00 PM. Reason: Inappropriate line highlighted in red - see next post

  13. #13
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: background color

    Sorry! Just noticed that it is more appropriate to use the following line:

    Please Login or Register  to view this content.
    instead of:

    Please Login or Register  to view this content.

    Either line will "work", but the original version calls the routine many times more than is actually required.


    Regards,

    Greg M

  14. #14
    Registered User
    Join Date
    12-08-2020
    Location
    Portugal
    MS-Off Ver
    profissional plus 2019
    Posts
    9

    Re: background color

    Hi.
    First, Merry Christmas to you all.
    This works fine, for one line... I used it P8 ("Status") whitch already covers it up.But the need is for all the Pn (P8, P9, P10, Pn). How to do it?

    Hope I got the attachment right...

    Thanks
    Attached Files Attached Files

  15. #15
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: background color

    Hi again,

    Thanks for your feedback.

    Take a look at the attached version of your workbook and see if it does what you need. It uses the following code in the "ThisWorkbook" VBA CodeModule:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

+ 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. Replies: 8
    Last Post: 04-02-2016, 04:00 AM
  2. Count / Sum based on Background Color with Manual and Conditional Format Color
    By sam99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2014, 08:00 PM
  3. Change cell background color based on another cells background color
    By Queo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 4
    Last Post: 06-10-2014, 05:28 AM
  4. Replies: 4
    Last Post: 12-29-2013, 11:41 PM
  5. Replies: 2
    Last Post: 02-25-2013, 03:36 AM
  6. Replies: 6
    Last Post: 11-07-2012, 10:46 AM
  7. [SOLVED] Macro to change all cells with a certain background color in another background color
    By kevinvzandvoort in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2012, 11:04 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