Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write code that applies conditional formatting when the date
in the active cell is a larger value than the date in a cell 2 columns to the left. I have users that enter these 2 dates, in a list of records, and I want all the text in each row to turn red when the above condition applies to the date values entered in that row. I want the conditional formatting code to evaluate every record in the list each time a change is made to the dates in these 2 columns. I have been trying to accomplish this with a Do While Loop, where I name the starting cell, evaluate the cell 2 columns to the left, Set the formatting if the condition is met, and move down to the next row, until encountering an empty cell. I am totally striking out here, and know my sytax is off, and my approach may also not be the appropriate one for what I am trying to accomplish. Any thoughts, or samlpes on how to compare 2 cell values in a row, apply formatting if the condition is met, and then check the rest of the records for the same condition?? (And update if the dates entered are changed?) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use the built in conditional formatting under the format menu
without using any code. http://www.contextures.com/tiptech.html will give you some generalized insights. for code Sub ABC() Dim rng as Range, cell as Range set rng = Range(cells(2,"F"),Cells(rows.count,"F").End(xlup) ) rng.EntireRow.Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,-2) then cell.EntireRow.Interior.colorIndex = 3 end if Next end sub Change the "F" to reflect the column that would contain the ActiveCell in your description. -- Regards, Tom Ogilvy "hspence" wrote: I am trying to write code that applies conditional formatting when the date in the active cell is a larger value than the date in a cell 2 columns to the left. I have users that enter these 2 dates, in a list of records, and I want all the text in each row to turn red when the above condition applies to the date values entered in that row. I want the conditional formatting code to evaluate every record in the list each time a change is made to the dates in these 2 columns. I have been trying to accomplish this with a Do While Loop, where I name the starting cell, evaluate the cell 2 columns to the left, Set the formatting if the condition is met, and move down to the next row, until encountering an empty cell. I am totally striking out here, and know my sytax is off, and my approach may also not be the appropriate one for what I am trying to accomplish. Any thoughts, or samlpes on how to compare 2 cell values in a row, apply formatting if the condition is met, and then check the rest of the records for the same condition?? (And update if the dates entered are changed?) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Analysis Toolpak-Confidence Level and data analysis questions | Excel Worksheet Functions | |||
What-If Analysis w Data Table and Input on Different Sheet | Excel Discussion (Misc queries) | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Analysis ToolPak installed but no Data Analysis option | Excel Discussion (Misc queries) | |||
Copy Formula loop based on number of rows w/ data in a col B. | Excel Programming |