Hi,
I am trying to write a code that will find a value in certain cell in column D and try to match with values in column A. Here is an example
A B C D E
ghi abc 123
abc def 345
def ghi 678
Ok I want to change to this:
A B C D E
678 abc 123
123 def 345
345 ghi 678
Here is what I have so far but it only works if my rows matches
Sub FindnReplace()
For x = 1 To 1000 Step 1
a = Cells(x, "C").Value
If a = Range("A" & x).Value Then
b = Cells(x, "D").Value
Range("A" & x) = b
End If
Next
End Sub
I am trying to write a code that will find a value in certain cell in column D and try to match with values in column A. Here is an example
A B C D E
ghi abc 123
abc def 345
def ghi 678
Ok I want to change to this:
A B C D E
678 abc 123
123 def 345
345 ghi 678
Here is what I have so far but it only works if my rows matches
Sub FindnReplace()
For x = 1 To 1000 Step 1
a = Cells(x, "C").Value
If a = Range("A" & x).Value Then
b = Cells(x, "D").Value
Range("A" & x) = b
End If
Next
End Sub