View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default Change text color

What you need is conditional formatting, select the cell or cells you want to
format then go to Format/Conditional Formatting.
condition 1: Cell value is: equal to: behind
then click on Format and format as desired, click on Add to add the second
condition
condition 2: Cell value is: equal to: ahead
again format as desired.

HTH
JG


"Stanley" wrote:

I have a function that does some calculations and returns some text. Now if
the text is one thing I want to change the text color to red. If it is
something else, change it to green, else leave it as is. I have some psuedo
code below to sort of show what I am looking for. My problem is how to
reference the cell that this function is being called from.

Function CalculateSchedule(budget As String, actual As String) As String
'do calculations

if behind text=red
elseif ahead text=green
else return text with no color

End Function