Results 1 to 6 of 6

Thread: if statement

  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: if statement

    In microsoft excel, I know how to do a standard if statement with characters and numbers, but I'm having a problem. Is it possible to use an if statement to change background color. Specifically, I have a huge spreadsheet with certain cells that are black. I need to change these cells to have an 'X' in them, so I was hoping there was some kind of if statement like this:

    if (background ="black", "x", "")

    I just don't know if there's a certain way to write that.

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    Only Conditional Formatting or VBA will allow you to change cell colors.
    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

  3. #3
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas, USA
    Posts
    68
    Conditional formatting cannot change the cell's contents, however. So you're left with VBA. Is this a one-time change, or do you need to automatically create an 'X' when the cell's background is changed?

  4. #4
    Join Date
    Mar 2004
    Posts
    4
    Basically it's a large spreadsheet. Some cells are normal (no color fill) and some are filled black. I'm looking for a shortcut formula that will put an 'X' in cells that are black, because going through one by one will take a while. If i have to do that I will, but a formula that can conditionally check the cells would make my life easier.

  5. #5
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas, USA
    Posts
    68
    Try the attached.
    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2004
    Posts
    4
    It was close enough. I know enough VB to edit the macro to how I need it. I just wasn't 100% sure on the syntax. It works great now. Thank you very much for your help.

Posting Permissions

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