Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Jason,
A user defined function (UDF) returns a value; it cannot change formatting or alter its environment --- Regards, Norman "Jason R Morris" wrote in message ... 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. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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" 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using logic to change the fill in a cell | Excel Discussion (Misc queries) | |||
change cell shading whenever contents different from previous cell | Excel Discussion (Misc queries) | |||
Function syntax to compare cell contents | Excel Worksheet Functions | |||
Hyperlinks using R[1]C[1] and offset function in its cell referenc | Excel Worksheet Functions | |||
Identifying the Active Fill Color | Excel Discussion (Misc queries) |