how do I change the fill collor os a cell using a function in VB

J

Jason R Morris

I am trying to us an if then statment in a function to change the fill color
of a cell if the conditions are true. I have tried
"ActiveCell.Interior.ColorIndex = 6" that works in subs, but it does not
works in functions.
 
N

Norman Jones

Hi Jason,

A user defined function (UDF) returns a value; it cannot change formatting
or alter its environment
 
B

BekkiM

Why not just use conditional formatting? You can set up essentially the same
If/then conditions and get your fill color that way.
 
Top