Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All
I am trying to simply create a VBA script to change the color of the active cell if the resulting value in that cell is less than 15%. In that cell there is a simple division formula referring to two other cells to give a percentage in that cell. I have come to the conclusion that a Function is better than a Sub but the following VBA script gives me a 'Value!' error. Any ideas for a rookie, please? Function EfficiencyRatio() ' ' EfficiencyRatio Macro ' Highlights the cell green if the expense ratio is less than 15% ' ' Keyboard Shortcut: Ctrl+Shift+X ' Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _ Formula1:="=0.15" Selection.FormatConditions(Selection.FormatConditi ons.Count).SetFirstPriority With Selection.FormatConditions(1).Font .Color = -16752384 .TintAndShade = 0 End With With Selection.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .Color = 13561798 .TintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = False End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to i change the active cell highlight color? | Excel Discussion (Misc queries) | |||
when I activate a cell i change color of active row & header from | Excel Worksheet Functions | |||
An auto macro to change color of the active cell | Excel Programming | |||
Change color on active cell | Excel Programming | |||
How do I change color of active cell in Excel | Excel Discussion (Misc queries) |