Results 1 to 8 of 8

Thread: color fill

  1. #1
    Join Date
    May 2009
    Posts
    3

    Unanswered: color fill

    Is it posible to have an VBA code that will, like conditional formatting does, fill the cell with color when you type in a number; this time we have a sequence or condition that the conditional formatting can't do. here's the trick: let's say we have cell A1 and cell B1, and default cell color is white,
    if we put any number in cell A1 it will change to color red; then whenever we put any number on cell B1, the cell B1 will turn to black; here's the turning point when B1 changes color fill, the cell A1 will also change into black from its color of red.

    Any assistance is appreciated.
    Attached Files Attached Files
    Last edited by robertiu; 05-15-09 at 12:32.

  2. #2
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Hi Robert,

    It is possible to do this in VBA. However it is unnecessary because it can be done using conditional formatting. I've attached an example in Excel 2007 (that's the version I have at home).

    The conditional formatting formula to turn A1 and B1 black is:
    Code:
    =AND(ISNUMBER($A$1),ISNUMBER($B$1))
    The conditional formatting formula to turn A1 red is:
    Code:
    =ISNUMBER($A$1)
    Hope that helps...
    Attached Files Attached Files

  3. #3
    Join Date
    May 2009
    Posts
    3

    RE: color fill

    Thank you for your reply, however this is what i want to happen, if I put any number on A1, A1 will turn into color red then if I put any number on B1, B1 will turn into black, so we have A1 as red and B1 as black, but I want is that if B1 will change into black the A1 will also turn into black.
    (Red for us is unpaid then when it turns black then it is paid.)

    I got here some pictures on how I want it to work. It is in order from 1 to 5
    Attached Files Attached Files

  4. #4
    Join Date
    Oct 2003
    Posts
    1,091
    Yes, you will need VBA for that last condition because it is checking the color of another cell, and that cannot be done with formulas (unless you write a function in VBA to achieve that). Check out Pearson's excellent help.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  5. #5
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Quote Originally Posted by robertiu
    Thank you for your reply, however this is what i want to happen, if I put any number on A1, A1 will turn into color red then if I put any number on B1, B1 will turn into black, so we have A1 as red and B1 as black, but I want is that if B1 will change into black the A1 will also turn into black.
    (Red for us is unpaid then when it turns black then it is paid.)

    I got here some pictures on how I want it to work. It is in order from 1 to 5
    Hi Robert,

    That is exactly what I attached on my post.

    The combinations are:
    A1 is a number / B1 is not a number ---> A1 is red, B1 is no fill.
    A1 is a number / B1 is a number ---> A1 is black, B1 is black.
    A1 is not a number / B1 is a number ---> A1 is no fill, B1 is black
    A1 is not a number / B1 is not a number ---> A1 is no fill, B1 is no fill.


    You do not need VBA to do this because you can check the underlying values in each cell as outlined by my formulas in post #2.

    I have now attached an example using Excel 2002. You can toggle the font colours in the conditional formatting also.
    Attached Files Attached Files

  6. #6
    Join Date
    May 2009
    Posts
    3

    color fill

    In the Philippines we say MABUHAY KA and thank you.

  7. #7
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    In the United Kingdom we say "you are welcome!".

  8. #8
    Join Date
    Jun 2009
    Location
    United States
    Posts
    1

    looking for a shoe website

    I was checking few blogs and they talk about some really great unique models of Jordan shoes and Air Force Ones, I've been looking online for a websites where I can by those Nike shoes from but I only find websites that sell fake shoes, I was hopping someone can help me find a websites that sell some real limited and unique styles of those shoes, like Nike dunks, Nike Air Max...but something real. Thank you everyone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •