samedi 1 juin 2019

How to copy a cell from a worksheet to another sheet depending on another cell value

I need to copy the value of column G from worksheet "Nouveautés 2020" to column C in worksheet "Feuil2", depending on the value of column AM. I'm able to do it, but I'm stuck at one row only. I need to be able to perform for the whole worksheet.

Also, this is something that I need to be able to perform multiple times, without copying twice the same row

Sub COPYVALUE()
Dim v1, v2, i As Long
If Range("AM5") <> 0 Then
v1 = Array("G5")
v2 = Array("C4")
For i = LBound(v1) To UBound(v1)
    Sheets("Feuil2").Range(v2(i)).Value = Sheets("Nouveautés 2020").Range(v1(i)).Value
Next i
End If
End Sub

Aucun commentaire:

Enregistrer un commentaire