1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Sub DD()
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Dim fincolonneA As Integer
Dim fincolonneB As Integer
Dim finligneA As Integer
Dim finligneB As Integer
Dim ColA As Integer
Dim ColConcB As Variant
Dim B As String
Set Ws1 = Worksheets("Feuil1")
Set Ws2 = Worksheets("Feuil2")
fincolonneA = Feuil1.Cells(1, Columns.Count).End(xlToLeft).Column + 1
fincolonneB = Feuil2.Cells(1, Columns.Count).End(xlToLeft).Column + 1
finligneA = Ws1.Range("A" & Rows.Count).End(xlUp).Row
finligneB = Ws2.Range("A" & Rows.Count).End(xlUp).Row
ColA = fincolonneA + 1
B = Cells(1, fincolonneA).Value
Ws2.Activate
ColConcB = Ws2.Range(Cells(1, fincolonneB), Cells(finligneB, fincolonneB))
ValeurA = Application.WorksheetFunction.VLookup("B", ColConcB, 1, False)
Ws1.Range(Cells(2, ColA)).Value = ValeurA
Range(Cells(2, ColA)).AutoFill Destination:=Range(Cells(2, ColA), Cells(finligneA, ColA))
End Sub |
Partager