detweiler
Board Regular
- Joined
- Aug 2, 2013
- Messages
- 62
Not being a coder, I found what I would think to be a pretty simple example of code on the Microsoft support site that compares data in two columns to find duplicates but puts the matching data in the column to the immediate right of the selected column.
Cool, but not quite what I need. I was able to tweak the code to include selecting the column data and am ( looking for ) needing help is tweaking the loop that puts the matching data in the column to the immediate right,
For Each x In Selection For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
What I am looking to modify is the If x = y Then... line to do two things,
I have tried -
Any suggestions of thoughts on how to get this to work is appreciated.
Thanks.
Cool, but not quite what I need. I was able to tweak the code to include selecting the column data and am ( looking for ) needing help is tweaking the loop that puts the matching data in the column to the immediate right,
For Each x In Selection For Each y In CompareRange
If x = y Then x.Offset(0, 1) = x
Next y
Next x
What I am looking to modify is the If x = y Then... line to do two things,
- If x = y, Then Offset(0, 1) = "x" - - place an actual x in the cell to the right, or
- If x <> y, Then Offset(0, 1) = "missing" - - place missing in the cell to the right.
I have tried -
- If x = y Then x.Offset(0, 1) = "x" Else x.Offset(0, 1) = "missing", and
- If x = y Then x.Offset(0, 1) = "x"
ElseIf If x <> y Then x.Offset(0, 1) = "missing"
Any suggestions of thoughts on how to get this to work is appreciated.
Thanks.
Last edited: