Bonjour,
Je cherche à pouvoir trouver un valeur dans la feuille 2 et copier/coller la ligne entiere de la cellule en question
Voici mon code, il fonctionne jusqu'à mon "With ws2"
Sub Sample()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim lRow1 As Long
Dim lRow2 As Long
Dim NomBarge1 As Variant
Dim NomBarge2 As Variant
Dim CopyLine2 As Integer
ws1 = ThisWorkbook.Sheets(1)
ws2 = ThisWorkbook.Sheets(2)
With ws1
lRow1 = .Range("C" & .Rows.Count).End(xlUp).Row
NomBarge1 = .Range("A1:A" & lRow1).Value
'.Range("g1:g" & lRow1).Value = NomBarge1
With ws2
NomBarge2 = Range("A:A").Find(What:=NomBarge1, LookIn:=xlValues).Select
Rows(Selection.Row).Copy
Rows(Selection.Row + 1).Insert Shift:=xlDown
Applcation.CutCopyMode = False
End With
End With
End Sub
Merci
Je cherche à pouvoir trouver un valeur dans la feuille 2 et copier/coller la ligne entiere de la cellule en question
Voici mon code, il fonctionne jusqu'à mon "With ws2"
Sub Sample()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim lRow1 As Long
Dim lRow2 As Long
Dim NomBarge1 As Variant
Dim NomBarge2 As Variant
Dim CopyLine2 As Integer
ws1 = ThisWorkbook.Sheets(1)
ws2 = ThisWorkbook.Sheets(2)
With ws1
lRow1 = .Range("C" & .Rows.Count).End(xlUp).Row
NomBarge1 = .Range("A1:A" & lRow1).Value
'.Range("g1:g" & lRow1).Value = NomBarge1
With ws2
NomBarge2 = Range("A:A").Find(What:=NomBarge1, LookIn:=xlValues).Select
Rows(Selection.Row).Copy
Rows(Selection.Row + 1).Insert Shift:=xlDown
Applcation.CutCopyMode = False
End With
End With
End Sub
Merci