Function calls a Sub to change the cell font color
But of course you can use conditional formatting to change the color
--
Kind Regards,
Niek Otten
Microsoft MVP - Excel
"grahamd" wrote in message
om...
Hi guys
I have written a function which returns a double but i want to call a
sub from within it which will set the font color of the cell
(in reality i want it to set the color of the ActiveCell)
Function foo(ByVal x as Double) as Double
.
.
if x 2 then
call setColorTo3()
foo = 123.456
else
call setColorTo1()
foo = 1.111
end if
.
.
End function
Sub setColorTo3()
Activecell.Select
With Selection.Font
.ColorIndex = 3
.Bold = True
End With
End Sub
Sub setColorTo1()
Activecell.Select
With Selection.Font
.ColorIndex = 1
.Bold = True
End With
End Sub
|