I would like to take values from column A and cut and paste them into column B, with each value exactly one cell to the left of their corresponding matching values from column C. Here is a before and after of what I would like to accomplish. Basically, each value from column A finds its match in column C and is copied, then pasted directly to the left of its match in column B.
Column A Column C
10 1
9 2
8 3
7 4
6 5
5 6
4 7
3 8
2 9
1 10
Column B Column C
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
Here it what I have tried:
Sub arrange()
Cells(1, 1).Activate
Do
If IsEmpty(ActiveCell) Then Exit Do
If ActiveCell.Offset(0, 2).Value = ActiveCell.Value Then
ActiveCell.Select
Selection.Copy
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Activate
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop
End Sub
The problem with this approach is that it only finds matching values in the same row. I want it to be able to search the entire column and place the value next to a match, whether the match is in the same row or not.