Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default CF based on data analysis, Loop thru sheet

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default CF based on data analysis, Loop thru sheet

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Analysis Toolpak-Confidence Level and data analysis questions MH Excel Worksheet Functions 0 January 3rd 09 06:15 PM
What-If Analysis w Data Table and Input on Different Sheet NYKarl Excel Discussion (Misc queries) 2 August 8th 07 03:12 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Analysis ToolPak installed but no Data Analysis option Eric Stephens Excel Discussion (Misc queries) 3 February 2nd 05 09:17 PM
Copy Formula loop based on number of rows w/ data in a col B. Bernie Deitrick Excel Programming 1 August 20th 04 10:17 PM


All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"