Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple Column Cell Compare looping through Rows

Hi I have a problem...... I need to compare 3 cells of data in
different columns D, E, and F. And Change the color of said cell t
Red if it is higher than the Cell in Column D and Green if it is Lowe
than the cell in column D. I need to do this for every row in th
worksheet starting with row 2.

I have this all worked out on paper but can't seem to get the synta
right. Keep in mind I'm more used to VB.Net than VBA and I'm learnin
as I go certain things just don't fly in VBA. Any amount of help woul
be greatly appreciated.

Thanks N

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Multiple Column Cell Compare looping through Rows

Dim rng as Range, cell as Range
Dim i as Long
set rng = Range(Range("D2"),Cells(rows.count,4).End(xlup))
for each cell in rng
for i = 1 to 2
if cell.offset(0,i).Value < cell.Value then
cell.offset(0,i).Interior.ColorIndex = 4
elseif cell.offset(0,i).Value cell.Value then
cell.offset(0,i).Interior.ColorIndex = 3
end if
Next i
Next cell

--
Regards,
Tom Ogilvy

"nickg420 " wrote in message
...
Hi I have a problem...... I need to compare 3 cells of data in 3
different columns D, E, and F. And Change the color of said cell to
Red if it is higher than the Cell in Column D and Green if it is Lower
than the cell in column D. I need to do this for every row in the
worksheet starting with row 2.

I have this all worked out on paper but can't seem to get the syntax
right. Keep in mind I'm more used to VB.Net than VBA and I'm learning
as I go certain things just don't fly in VBA. Any amount of help would
be greatly appreciated.

Thanks NG


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Multiple Column Cell Compare looping through Rows

Hi Nick

if i'm understanding you correctly i would use conditional formatting for
this - select from E2 to the end of the numbers in column E choose
Format / Conditional formatting
choose
formula is
and type
=$E2$D2
click on the format button and choose Red - click OK

then click the ADD button
choose
formula is
and type
=$E2<$D2
click on the format button and choose Green - click OK, click OK again

repeat for column F (starting at F2)

Hope this helps
Cheers
JulieD


"nickg420 " wrote in message
...
Hi I have a problem...... I need to compare 3 cells of data in 3
different columns D, E, and F. And Change the color of said cell to
Red if it is higher than the Cell in Column D and Green if it is Lower
than the cell in column D. I need to do this for every row in the
worksheet starting with row 2.

I have this all worked out on paper but can't seem to get the syntax
right. Keep in mind I'm more used to VB.Net than VBA and I'm learning
as I go certain things just don't fly in VBA. Any amount of help would
be greatly appreciated.

Thanks NG


---
Message posted from http://www.ExcelForum.com/



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
Maddening Dilemma - Compare each cell within column a to each cell in column b and find unique matches [email protected] Excel Worksheet Functions 66 May 1st 23 03:44 AM
Multiple Cells/rows in Column selected when a single cell is click Mick Excel Discussion (Misc queries) 0 October 10th 08 02:05 PM
count rows in a column for looping damorrison Excel Discussion (Misc queries) 2 April 8th 07 10:30 PM
Compare and display multiple rows Greg Excel Worksheet Functions 1 June 9th 05 04:20 PM
Formula to compare multiple rows values based on another column? Murph Excel Worksheet Functions 4 February 21st 05 02:44 AM


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

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

About Us

"It's about Microsoft Excel"