Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In this example the formulae in column AB will return "G" or "O" or "R" for
green or orange or red. It is event code to be inserted in the worksheet code area: Private Sub Worksheet_Calculate() Dim n As Long n = Cells(Rows.Count, "AB").End(xlUp).Row For i = 1 To n codee = Cells(i, "AB").Value Select Case codee Case "G" clr = 10 Case "O" clr = 46 Case "R" clr = 3 Case Else clr = xlNone End Select With Cells(i, "AB").EntireRow .Interior.ColorIndex = clr End With Next End Sub Because it is worksheet code, it is very easy to install and use: 1. right-click the tab name near the bottom of the window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200852 "Jock" wrote: In a sheet with (max)10000 rows, any of the rows could be shaded green(when criteria 1 is met), orange (criteria 2), or red (3). The criteria will appear in column "AB" by formula e.g. =IF($S410,"W",""). This formula will change as I add bits to it but the premise is that the code needs to look at column AB and deal with whatever result is displayed by the formula (max of 3. If the criteria in any cell in "AB" alters or is removed entirely, the row will need to reflect this. How would I do this by code? -- Traa Dy Liooar Jock |