Hello, how can I do the same thing, but without copying formats. Copy values only
VBA Code:
Sub copy_test()
Dim c As Range, lr As Long, dl As Long
Dim cDest As Range, Réf As Range, Rng As Range
Dim WSdata As Worksheet: Set WSdata = Worksheets("Ordre")
Dim WSdest As Worksheet: Set WSdest = Worksheets("PL")
Set Réf = WSdata.Range("o2")
dl = WSdata.Cells(WSdata.Rows.Count, 1).End(xlUp).Row
lr = WSdest.Cells(Rows.Count, "a").End(xlUp).Row
Set Rng = WSdata.Range("a2:a" & dl).Find(What:=Réf, LookIn:=xlValues, LookAt:=xlWhole)
If Not Rng Is Nothing Then
WSdest.Range("a2:m" & lr).ClearContents
WSdata.Rows(1).Copy WSdest.Rows(1)
Set cDest = WSdest.Range("a2:m2")
Application.ScreenUpdating = False
For Each c In WSdata.Range("a2:a" & WSdata.Cells(Rows.Count, "a").End(xlUp).Row).Cells
If Not IsError(Application.Match(c.Value, Réf, 0)) Then
With WSdata
.Range(.Cells(c.Row, "a"), .Cells(c.Row, "m")).Copy cDest
End With
Set cDest = cDest.Offset(1)
End If
Next c
Else
MsgBox "unavailable!!"
End If
Application.ScreenUpdating = True
End Sub