Sub CopierCollerLignes()
Dim wsBase As Worksheet
Dim wsResult As Worksheet
Dim data As Variant
Dim i As Long
Dim ref As String
Dim startRow As Long
Dim endRow As Long
Set wsBase = ThisWorkbook.Sheets("Base")
Set wsResult = ThisWorkbook.Sheets("Result")
ref = wsResult.Range("B2").Value
wsResult.Range("C2:Q" & wsResult.Cells(wsResult.Rows.Count, "D").End(xlUp).Row).ClearContents
data = wsBase.Range("A2:O" & wsBase.Cells(wsBase.Rows.Count, "A").End(xlUp).Row).Value
Application.ScreenUpdating = False
For i = 1 To UBound(data, 1)
' Si la cellule commence par la référence
If Left(data(i, 1), Len(ref)) = ref Then
' Copier la ligne du tableau dans "Result"
wsResult.Range("C" & wsResult.Cells(wsResult.Rows.Count, "C").End(xlUp).Row + 1 & ":Q" & wsResult.Cells(wsResult.Rows.Count, "C").End(xlUp).Row + 1).Value = Application.Index(data, i, 0)
ElseIf Left(data(i, 1), Len(ref)) > ref Then
' Si la cellule contient une valeur supérieure à la référence, quitter la boucle
Exit For
End If
Next i
Set wsBase = Nothing
Set wsResult = Nothing
End Sub