cell formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to format a cell based upon the contents of another cell. The
problem is that the determining cell has five variations - hence I cannot use
conditional formatting as this only allows three variations. In total, on a
worksheet, I have about 160 cells whose format I wish to change based upon
the contents of 160 associated cells on another worksheet. When changing the
format, I wish to change forground and background colours.
Any help would be much appreciated.
Thanks, Simon
 
Simon,

If you could describe your 5 variations and what you would like the
cell formatted as for each it would be helpful. Will each variation
produce a unique formatting? If multiple variations will result in the
same format, CF may work for you using formulas.



Steve
 
Without details on desired colors vs values here is a simple sample demo of
how to change the interior color of B1 based upon the value in A1:

Sub Macro1()
Range("B1").Interior.ColorIndex = Range("A1").Value
End Sub

1. enter the macro
2. put a number in A1 (like 36)
3. run the macro


The sample can easily be modified to handle alternative mappings and font
colors as well.
 
Steve

Thanks for the reply.
I have a column of entries in column C. All entries are integers from 1 to
5. I wish to format Column A based upon the entries in Column C.

If the entry in cell C is "1" then format cell in column A background RED
forground WHITE.

If the entry in cell C is "2" then format cell in column A background GREEN
forground BLACK.

If the entry in cell C is "3" then format cell in column A background YELLOW
forground BLACK.

If the entry in cell C is "4" then format cell in column A background BLUE
forground WHITE.

If the entry in cell C is "5" then format cell in column A background LIGHT
GREY forground BLACK.

Many thanks
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top