PC Review


Reply
Thread Tools Rate Thread

CF based on data analysis, Loop thru sheet

 
 
=?Utf-8?B?aHNwZW5jZQ==?=
Guest
Posts: n/a
 
      22nd Mar 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      22nd Mar 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Microsoft Excel Misc 2 15th May 2010 06:49 AM
Appending collected x & y data from linkage analysis to another sheet mstickma Microsoft Excel Discussion 1 4th Mar 2008 12:45 AM
What-If Analysis w Data Table and Input on Different Sheet =?Utf-8?B?TllLYXJs?= Microsoft Excel Misc 2 8th Aug 2007 03:12 PM
Move data to new sheet - rename sheet based on criteria ? Michael.Ray.Pennington@gmail.com Microsoft Excel Misc 7 16th May 2007 10:22 PM
How can I make a sheet display data from another sheet based on date criteria? CW Microsoft Excel Discussion 1 12th May 2007 04:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:25 PM.