Can anyone provide a VBA macro?
To compare two rows of values, if the lower row value equals
the upper row value color both values green.
Need this across 70 columns
Example:
Row 1 0 1 4 4 5 6 7
Row 2 4 4 8 4 9 0 8
4 in Row 1 & Row 2 would be highlited
With Thanks
dolivastro@gmail.com - 03 Oct 2006 15:37 GMT
First select the data you want compared. Then use this script:
dim r as long
dim c as long
for r = 1 to selection.rows.count
if (selection.cells(r,1).value = selection.cells(r,2).value) then
for c = 1 to 2
selection.cells(r,c).interior.colorindex = 3
selection.cells(r,c).interior.pattern=xlSolid
next c
end if
next f
Hope this helps
Dom
> Can anyone provide a VBA macro?
> To compare two rows of values, if the lower row value equals
[quoted text clipped - 9 lines]
>
> With Thanks
Bernard Liengme - 03 Oct 2006 15:39 GMT
No need for a macro; can be done using Format | Conditional Formatting with
Formula is =A2=A3
best wishes

Signature
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email
> Can anyone provide a VBA macro?
> To compare two rows of values, if the lower row value equals
[quoted text clipped - 9 lines]
>
> With Thanks
CLR - 03 Oct 2006 16:37 GMT
What you desire can be easily accomplished with the Excel feature called
Conditional Formatting......no macro required.
First, highlight cells A1 and A2, then do Format > ConditionalFormat > then
in the left window select "Formula is" and in the right window type the
formula
=AND(SUM(A$12:A$13)>0,A$12=A$13), then select the Format button on the
pop-up and choose the Patterns Tab, and click on a Green square, then ok >
ok, Then, highlight the same two cells and select the FormatPainter icon in
the upper toolbar, (the little paintbrush), and drag it across all the cells
you wish to format the same.......ie, your 70 columns. This will make the
cells turn green if they are matching in value and ARE NOT ZERO, OR
EMPTY.......
hth
Vaya con Dios,
Chuck, CABGx3
> Can anyone provide a VBA macro?
> To compare two rows of values, if the lower row value equals
[quoted text clipped - 9 lines]
>
> With Thanks
Bruno - 03 Oct 2006 18:47 GMT
There is the mistake in the formula:
A$12 should be A$1, and A$13 sholud be A$2. I also tried it and after I
corrected cell references it works perfectly.
Bruno
CLR - 03 Oct 2006 18:56 GMT
Good "catch" Bruno.........I did my testing a little further down the sheet
and forgot to convert when I posted........
Vaya con Dios,
Chuck, CABGx3
> There is the mistake in the formula:
> A$12 should be A$1, and A$13 sholud be A$2. I also tried it and after I
> corrected cell references it works perfectly.
> Bruno
smandula@idirect.com - 03 Oct 2006 21:25 GMT
Thanks for all your relies.
However, I was hoping for a VBA solution.
With Thanks
smandula@idirect.com - 04 Oct 2006 03:23 GMT
Created a VBA solution myself.
Thanks for Looking, to all respondents
Lars - 04 Oct 2006 10:59 GMT
>Created a VBA solution myself.
>
>Thanks for Looking, to all respondents
I think you should share your solution with us!
That is was Usenet is all about.
Lars
Stockholm