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.
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.
Hi Jason,
A user defined function (UDF) returns a value; it cannot change formatting
or alter its environment
---
Regards,
Norman
"Jason R Morris" <JasonRMorris@discussions.microsoft.com> wrote in message
news:8A8AFC30-C48E-43A9-B6CD-B46540955F7A@microsoft.com...
>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.
Why not just use conditional formatting? You can set up essentially the same
If/then conditions and get your fill color that way.
"Jason R Morris" wrote:
> 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.
see Conditional Formatting
http://www.mvps.org/dmcritchie/excel/condfmt.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
"BekkiM" <BekkiM@discussions.microsoft.com> wrote...
> Why not just use conditional formatting? You can set up essentially the same
> If/then conditions and get your fill color that way.
>
> "Jason R Morris" wrote:
> > 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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks