Bonjour,
Si cela était si long ... soit la machine est de faible capacité ou il y a trop de processus qui tournent en arrière plan ...
Il est bien entendu qu'en passant pas une variable tableau ... le processus gagnerait en rapidité ... mais, c'est moi qui ne réussit pas à bien concevoir ces fameuses variables tableau.
Quoi qu'il en soit ... cette version devrait être quand même plus rapide > j'ai ajouté une condition pour terminer les boucles plus rapidement ...
Sub Nettoyage_onglet_scan()
Dim MaPlage As Range
Dim MaPlageR As Range
Dim Cl As Range
Dim Clr As Range
Dim X As Integer, Z As Byte
Dim Ws As Worksheet
Worksheets("affectation lot-chariot").Activate
Application.ScreenUpdating = False
Set Ws = Worksheets("affectation lot-chariot")
Set MaPlage = Ws.Range("B2:L" & Ws.UsedRange.Rows.Count)
Set MaPlageR = Worksheets("lot finis").Range("A2:A" & Worksheets("lot finis").UsedRange.Rows.Count)
For Each Cl In MaPlage
Set Clr = MaPlageR.Find(What:=Cl, LookAt:=xlWhole)
If Not Clr Is Nothing Then Cl.ClearContents
Next Cl
For X = Ws.UsedRange.Rows.Count To 2 Step -1
For Z = 2 To 11 ' << modif pour l'ajout des colonnes
If Application.WorksheetFunction.CountA(Range(Cells(X, Z + 1), Cells(X, 12))) = 0 Then Exit For ' <<< ajout de la condition
Do While Ws.Cells(X, Z) = "" And Application.WorksheetFunction.CountA(Range(Cells(X, Z + 1), Cells(X, 12))) > 0
Range(Cells(X, Z + 1), Cells(X, 12)).Copy Ws.Cells(X, Z)
Loop
Next Z
Next X
End Sub
ric