Color in Cells

J

jladika

I have a spreadsheet that

say in B2 i have three different inputs optinons

when i put the letter "A" in i want the cell to turn red
when i put the letter "B" in i want the cell to turn blue
when i put the letter "C" in i want the cell to turn green

is there a way to do this automatic??
 
J

jiser

it's quite simple. Click one time in a cell with your left mouse button
Click once your right button of your mouse once and select with you
left button of your mouse with one single click "format.......
 
J

jladika

i want to have each of the options give me different colors

a to = red
b to = green
c to = yellow

all three of these will a option for the same cel
 
N

Norman Harker

Hi jladika!

Select the cell
Format > Conditional Formatting
Select "Cell Value is" from first drop down
Select "Equal to from second drop down
Type ="a" in right text box
Press Format button
Select Pattern Tab
Select a red colour
OK
Press Add button
etc.

The only difficult bit /common problem is not using ="a" for a text
condition.
 
D

David McRitchie

Hi jladika!
Just in case you thought you would extend one cell
to several more cells it would be better to do them all
at once rather than one at a time such as with the
Format Painter.

Conditional Formatting
http://www.mvps.org/dmcritchie/excel/condfmt.htm


Norman Harker said:
Hi jladika!

Select the cell
Format > Conditional Formatting
Select "Cell Value is" from first drop down
Select "Equal to from second drop down
Type ="a" in right text box
Press Format button
Select Pattern Tab
Select a red colour
OK
Press Add button
etc.

The only difficult bit /common problem is not using ="a" for a text
condition.
 
J

jladika

would you show me an example for

please in one cell "A" = red
"B"= blue
"C"= green
"D" = yellow
thanks jo
 
D

David McRitchie

Hi Joe,
You were supplied a solution, but this would be my solution.
Suggest reading:
http://www.mvps.org/dmcritchie/excel/condfmt.htm

Select the column(s) you want the change to affect the
coloration. If you want rows to be colored then use Ctrl+A
You can select a cell before using Ctrl+A.

The formula you use is based on the active cell,
the cells that get colored are based on your selection,
so if Cell A1 is active you might code
format, conditional formatting
C.F formula 1: =$A1="a"
C.F formula 2: =$A1="b"
C.F formula 3: =$A1="c"
when you enter each formula, you click on the
format in the middle, and make choices on
Font and or Patterns (tabs). These Worksheet
formulas are not case sensitive.

If you have more than 3 colors you will have to use
and Event Macro.
http://www.mvps.org/dmcritchie/excel/event.htm#case
 
N

Norman Harker

Hi Jladika!

Conditional formatting is limited to three conditions.

However you do have the default format that applies where no condition
is satisfied.

You also have the possibility of different formats for (usually)
positive, negative and zero.

But in most cases where you need more than three formats for your
conditions, you will need to resort to VBA. For this, David McRitchie
has already referred you to:

http://www.mvps.org/dmcritchie/excel/event.htm#case

However, if you are doing this for mainly presentation purposes, my
own view is that you should try to avoid too many different colours.
 
D

Don Guillett

Right click on the sheet tab>view code>copy/paste this.Adapt the letters and
color numbers to your needs. As written, it works on column A (1). Again,
change to suit.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
Target.Interior.ColorIndex = 0
If UCase(Target) = "U" Then _
Target.Interior.ColorIndex = 5
If UCase(Target) = "D" Then _
Target.Interior.ColorIndex = 7
End Sub
 
J

jladika

can someone help me out
when i get send a forumla like this

vLetter=Ucase(left(cell.value&"",1))

can someone break it done so i can understand it
like give me an example. thank
 
D

David McRitchie

I expect you left out a space between the double quotes.
Event Macros, Worksheet Events and Workbook Events
http://www.mvps.org/dmcritchie/excel/event.htm#case

LEFT in VBA works almost the same as LEFT in Excel it
takes the leftmost characters, the " " in the
concatenation guarantees something will be there
even if it is a space.

Concatenation (adds to the end of)
varA = "abc "
varB = "def"
varC = varA & varB gets same value as varC = "abc def"

UCase in VBA works the same as UPPER in Excel
it converts the character to uppercase. Most of
the things with Excel Worksheet Functions are not
case sensitive. Most of the things in VBA are
case sensitive. So we will want be later comparing
capital letter to a capital letter in the macro with
Select Case.
http://www.mvps.org/dmcritchie/excel/strings.htm#sensitivity
 
J

jladika

thanks for all who helped me out
i got it yea

is there somewhere i can find what color goes with what number
 

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

Top