Dave, How is that materially different from my original?
for each c in selection
if c=c.offset(,1)then c=c.offset(,2)
next
"Dave Peterson" wrote in message
...
how about:
Option Explicit
Sub Chck()
Dim c As Range
With ActiveSheet
For Each c In .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)).Cells
'compare column A with the one to its right
If LCase(c.Value) = LCase(c.Offset(0, 1).Value) Then
'if they were the same, then move
'2 over (to the right) to column A.
c.Value = c.Offset(0, 2).Value
End If
Next c
End With
End Sub
SolaSig AB wrote:
Dear Don,
Thanks but I actually didn't understand how to make this Sub.
I have combined all your post and got following subs. But this don't
work :(
Here are two Subs, but I don't know what is wrong:
Sub Chck()
for each c in range(cells(1,1),cells(cells(65536).end(xlup).row, 1))
if c=c.offset(,1)then c=c.offset(,2)
next
End Sub
Sub Chck2()
for each c in range("a1:a"&range("a65536").end(xlup).row)
if c=c.offset(,1)then c=c.offset(,2)
next
End Sub
As I see this Sub compares Values in Columns for same Row, but if cell
will
be in another row the Sub will not find any match.
It may work for
RED RED R
BLUE BLUE B
But not for
RED BLUE B
BLUE RED R
--
Dave Peterson