View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Can you use formulas to manipulate the fill color of a cell?

Assume your goal is 80 and the cell is A1.

Private Sub Worksheet_Change(By Val Target As Range)
If Cells(1, 1) <= 79 And Cells(1, 1) < "" Then
Cells(1, 1).Interior.ColorIndex = 3
Cells(1, 1).Font.ColorIndex = 2
ElseIf Cells(1, 1) = 80 And Cells(1, 1) < "" Then
Cells(1, 1).Interior.ColorIndex = 10
Cells(1, 1).Font.ColorIndex = 1
End If
End Sub

This would go in your Worksheet code module. Right click the sheet tab,
click view code, copy above code and paste into module.

"kAustin79" wrote:

I have Excel 2003. I want to change the fill color of a cell in relation to
it's own contents (ex. I will set a number as a goal for myself. There will
be a cell that will calculate my progress. While I am still under my goal
number, the fill color of the cell will be red and the text white - Once I
exceed my goal, the fill color will turn green and the text will be black).