adrianp
adrianp

Reputation: 23

find and replace if 2 columns are the same

So I have this table, if cell in column P matches cell in column V, replace Q cell with value from column W.

enter image description here

I found this vba script, but doesn't do what I really need I cant figure out how to edit it.

https://www.extendoffice.com/documents/excel/1873-excel-find-and-replace-multiple-values-at-once.html

Can you help me ?

Upvotes: 2

Views: 76

Answers (1)

Gary's Student
Gary's Student

Reputation: 96771

Consider:

Sub Substi_toot()
    Dim i As Long, N As Long

    N = Cells(Rows.Count, "P").End(xlUp).Row
    For i = 1 To N
        If Cells(i, "P") = Cells(i, "V") Then Cells(i, "Q") = Cells(i, "W")
    Next i
End Sub

Upvotes: 1

Related Questions