View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
grahamd grahamd is offline
external usenet poster
 
Posts: 4
Default Function calls a Sub to change the cell font color

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