Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Maddening Dilemma - Compare each cell within column a to each cell in column b and find unique matches | Excel Worksheet Functions | |||
Multiple Cells/rows in Column selected when a single cell is click | Excel Discussion (Misc queries) | |||
count rows in a column for looping | Excel Discussion (Misc queries) | |||
Compare and display multiple rows | Excel Worksheet Functions | |||
Formula to compare multiple rows values based on another column? | Excel Worksheet Functions |