Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
Hi,
I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
set rng = Range("A1:A100")
rng.Resize(,2).Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next -- regards, Tom Ogilvy "DrwRob28" wrote in message ups.com... Hi, I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
Thanks Tom!\
Tom Ogilvy wrote: set rng = Range("A1:A100") rng.Resize(,2).Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next -- regards, Tom Ogilvy "DrwRob28" wrote in message ups.com... Hi, I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
Thanks Tom!\
Tom Ogilvy wrote: set rng = Range("A1:A100") rng.Resize(,2).Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next -- regards, Tom Ogilvy "DrwRob28" wrote in message ups.com... Hi, I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
Tom,
Do you know how I can get it to skip to columns C and D, E and F, etc.after it is doen with A and B? Thanks, Drew DrwRob28 wrote: Thanks Tom!\ Tom Ogilvy wrote: set rng = Range("A1:A100") rng.Resize(,2).Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next -- regards, Tom Ogilvy "DrwRob28" wrote in message ups.com... Hi, I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loop Down Columns and Compare Values
Something screwy happened and an incomplete post may have been posted. use
this post Dim rng as Range, ar as Range set rng = Range("A1:A100,C1:C100,E1:E100") for each ar in rng.Areas ar.Resize(,2).Interior.ColorIndex = xlNone for each cell in ar if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next cell Next ar -- Regards, Tom Ogilvy "DrwRob28" wrote: Tom, Do you know how I can get it to skip to columns C and D, E and F, etc.after it is doen with A and B? Thanks, Drew DrwRob28 wrote: Thanks Tom!\ Tom Ogilvy wrote: set rng = Range("A1:A100") rng.Resize(,2).Interior.ColorIndex = xlNone for each cell in rng if cell.Value cell.offset(0,1).Value then cell.Resize(1,2).Interior.ColorIndex = 3 end if Next -- regards, Tom Ogilvy "DrwRob28" wrote in message ups.com... Hi, I am trying to write a macro that will loop through columns (eg A and B) and across the row and compare the values on the same row in different columns and if the value in column A on that same row is greater then I would like to highlight those cells. Is there anyone who could help? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare values in different columns | Excel Discussion (Misc queries) | |||
I want to compare the values in two columns | Excel Discussion (Misc queries) | |||
Compare values in different columns | Excel Programming | |||
Compare values in columns | New Users to Excel | |||
Excel Compare values in columns & display missing values in a new | Excel Discussion (Misc queries) |