View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Eddie[_6_] Eddie[_6_] is offline
external usenet poster
 
Posts: 3
Default Change Font Color

Hi it's me again,

I have included a sample of the code I wrote:

Function AddTwo(arg1, arg2)

ActiveCell.Font.Color = vbRed
AddTwo = arg1 + arg2

End Function

And I call the function "=AddTwo (A1, B1)"

It returns the right sum but it doesn't change the color.

Please help.

Regards
Eddie

"Eddie" wrote in message
...
Hi All,

I am newbie with VBA. I need some help. I am trying to write a function

that
will do a sum of 2 numbers. Depending on the result of the sum, the result
needs to be color coded i.e 0 - 10 is yellow, 11 - 20 is red, 21 - 30 is
blue. I need to create about 8 ranges. Excel's conditional formatting only
allows 3 criteria. I am able to get the sum bit working but I can't set

the
color. Can any help please?

Many thanks in advance.
Regards
Eddie