View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
red5 red5 is offline
external usenet poster
 
Posts: 1
Default Excel VBA-Changing cell color with if then function

I am using office 2000 and tring to write a function in which th
argument is multiplied by 12. If the result is less than 36 I woul
like the answer to be highlited in a red cell. If it is greater that o
equal to 36 it will remain a white cell. What I have written gives m
the numerical answer but does not change the color of the box. This i
what I have. Thank you for your help
Mike

Public Function mult(a As Single) As Single
mult = a * 12
If 36 mult Then

ActiveCell.Interior.ColorIndex = 3
Else
ActiveCell.Interior.ColorIndex = 2
End If

End Functio

--
Message posted from http://www.ExcelForum.com