#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Fill Color

Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

€śBelow€ť should be RED, €śAt Risk€ť should be YELLOW, €śMeets€ť should be GREEN,
and €śExceeds€ť should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Fill Color

Do the cells contain formulae that display the text or just typed text??
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

€śBelow€ť should be RED, €śAt Risk€ť should be YELLOW, €śMeets€ť should be GREEN,
and €śExceeds€ť should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Fill Color

They contain a a vlookup formula that pulls the text from another sheet. Had
there been 3 values I would have used conditional formatting but the fourth
one put me over the top. At least in Excel 2003....

"Gary''s Student" wrote:

Do the cells contain formulae that display the text or just typed text??
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

€śBelow€ť should be RED, €śAt Risk€ť should be YELLOW, €śMeets€ť should be GREEN,
and €śExceeds€ť should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Fill Color

you can give this a try. change the worksheet name and the column letter. you
may also want to change the shades of the colors.

Sub Var_Colors()
Dim ws As Worksheet
Dim i As Long
Dim icolor As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row

For i = 2 To lastrow
With ws.Range("C" & lastrow)
Select Case UCase(.Value)
Case "BELOW"
icolor = 3
Case "AT RISK"
icolor = 6
Case "MEETS"
icolor = 4
Case "EXCEEDS"
icolor = 5
End Select
.Interior.ColorIndex = icolor
End With
Next
End Sub


--


Gary

"Walt Herman" wrote in message
...
Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

"Below" should be RED, "At Risk" should be YELLOW, "Meets" should be GREEN,
and "Exceeds" should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Fill Color

In the worksheet code area, put the following event macro:

Private Sub Worksheet_Calculate()
Set b = Intersect(Range("B:B"), ActiveSheet.UsedRange)
For Each cel In b
v = xlNone
If cel.Value = "Below" Then
v = 3
End If
If cel.Value = "Meets" Then
v = 10
End If
If cel.Value = "Exceeds" Then
v = 5
End If
If cel.Value = "At Risk" Then
v = 6
End If
cel.Interior.ColorIndex = v
Next
End Sub


It colors column B. Adapt to suit.

REMEBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

They contain a a vlookup formula that pulls the text from another sheet. Had
there been 3 values I would have used conditional formatting but the fourth
one put me over the top. At least in Excel 2003....

"Gary''s Student" wrote:

Do the cells contain formulae that display the text or just typed text??
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

€śBelow€ť should be RED, €śAt Risk€ť should be YELLOW, €śMeets€ť should be GREEN,
and €śExceeds€ť should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Fill Color

I am very grateful. Thank you.

"Gary Keramidas" wrote:

you can give this a try. change the worksheet name and the column letter. you
may also want to change the shades of the colors.

Sub Var_Colors()
Dim ws As Worksheet
Dim i As Long
Dim icolor As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row

For i = 2 To lastrow
With ws.Range("C" & lastrow)
Select Case UCase(.Value)
Case "BELOW"
icolor = 3
Case "AT RISK"
icolor = 6
Case "MEETS"
icolor = 4
Case "EXCEEDS"
icolor = 5
End Select
.Interior.ColorIndex = icolor
End With
Next
End Sub


--


Gary

"Walt Herman" wrote in message
...
Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

"Below" should be RED, "At Risk" should be YELLOW, "Meets" should be GREEN,
and "Exceeds" should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Fill Color

would i paste this into a worksheet change event to effect the automatic
apsects of it? can you help? sorry....

"Gary Keramidas" wrote:

you can give this a try. change the worksheet name and the column letter. you
may also want to change the shades of the colors.

Sub Var_Colors()
Dim ws As Worksheet
Dim i As Long
Dim icolor As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row

For i = 2 To lastrow
With ws.Range("C" & lastrow)
Select Case UCase(.Value)
Case "BELOW"
icolor = 3
Case "AT RISK"
icolor = 6
Case "MEETS"
icolor = 4
Case "EXCEEDS"
icolor = 5
End Select
.Interior.ColorIndex = icolor
End With
Next
End Sub


--


Gary

"Walt Herman" wrote in message
...
Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

"Below" should be RED, "At Risk" should be YELLOW, "Meets" should be GREEN,
and "Exceeds" should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Fill Color

Not working, I altered the refernce to column M as shown below, but all of
the cells have no fill at all in column M. Thanks again...

Private Sub Worksheet_Calculate()
Set b = Intersect(Range("M:M"), ActiveSheet.UsedRange)
For Each cel In b
v = xlNone
If cel.Value = "Below" Then
v = 3
End If
If cel.Value = "Meets" Then
v = 10
End If
If cel.Value = "Exceeds" Then
v = 5
End If
If cel.Value = "At Risk" Then
v = 6
End If
cel.Interior.ColorIndex = v
Next
End Sub

"Gary''s Student" wrote:

In the worksheet code area, put the following event macro:

Private Sub Worksheet_Calculate()
Set b = Intersect(Range("B:B"), ActiveSheet.UsedRange)
For Each cel In b
v = xlNone
If cel.Value = "Below" Then
v = 3
End If
If cel.Value = "Meets" Then
v = 10
End If
If cel.Value = "Exceeds" Then
v = 5
End If
If cel.Value = "At Risk" Then
v = 6
End If
cel.Interior.ColorIndex = v
Next
End Sub


It colors column B. Adapt to suit.

REMEBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

They contain a a vlookup formula that pulls the text from another sheet. Had
there been 3 values I would have used conditional formatting but the fourth
one put me over the top. At least in Excel 2003....

"Gary''s Student" wrote:

Do the cells contain formulae that display the text or just typed text??
--
Gary''s Student - gsnu200811


"Walt Herman" wrote:

Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

€śBelow€ť should be RED, €śAt Risk€ť should be YELLOW, €śMeets€ť should be GREEN,
and €śExceeds€ť should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Fill Color

not sure if you have any other code or what you do to change your data, but if
you paste this on the worksheet code page, it may work for you

in the vb editor, right click the worksheet and click view code, then paste it.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim i As Long
Dim rng As Range
Dim icolor As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "M").End(xlUp).Row

For i = 2 To lastrow
With ws.Range("M" & i)
Select Case UCase(.Value)
Case "BELOW"
icolor = 3
Case "AT RISK"
icolor = 6
Case "MEETS"
icolor = 4
Case "EXCEEDS"
icolor = 5
Case Else
icolor = 0
End Select
.Interior.ColorIndex = icolor
End With
Next
End Sub

--


Gary

"Walt Herman" wrote in message
...
would i paste this into a worksheet change event to effect the automatic
apsects of it? can you help? sorry....

"Gary Keramidas" wrote:

you can give this a try. change the worksheet name and the column letter. you
may also want to change the shades of the colors.

Sub Var_Colors()
Dim ws As Worksheet
Dim i As Long
Dim icolor As Long
Dim lastrow As Long
Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row

For i = 2 To lastrow
With ws.Range("C" & lastrow)
Select Case UCase(.Value)
Case "BELOW"
icolor = 3
Case "AT RISK"
icolor = 6
Case "MEETS"
icolor = 4
Case "EXCEEDS"
icolor = 5
End Select
.Interior.ColorIndex = icolor
End With
Next
End Sub


--


Gary

"Walt Herman" wrote in message
...
Ok, I honestly spent a good half hour trying to find a posting which
approximated what I wanted to do and have run out of patience. Can someone
please help me?

I have a variance report with a column that evaluates the results of each
variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk.

I need the fill color for each of these values to change automatically as
the evaluation changes. The rules for the fill color a

"Below" should be RED, "At Risk" should be YELLOW, "Meets" should be GREEN,
and "Exceeds" should be BLUE.

I am sure there needs to be a case statement but really seem to be
challenged in writing the code. I appreciate any help you can provide.

Regards,

Walt






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
color fill button is not adding color to my spread sheet mitchnmd Excel Worksheet Functions 1 September 26th 07 04:36 PM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM


All times are GMT +1. The time now is 09:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"