C'est un exemple que j'ai créé pour vous. Dans mon fichier il y a une plus de 60 000 lignes. Je suis en train d'optimiser la procédure avec une seule Macro.
Sub Macro()
With ThisWorkbook
Workbooks.Open ("D:\Fichiers_Partages\Gestion\Classeur2.xlsx")
Range("I:L,N:N,P:W").Select
Selection.Delete Shift:=xlToLeft
For i = 2 To Cells(Rows.Count, "B").End(xlUp).Row
If Cells(i, "D") = 2 Then
Cells(i, "K").Value = Format(Cells(i, "B"), "00") & "." & Format(Cells(i, "D"), "0000") & "." & Format(Cells(i, "E"), "00") & "." & Format(Cells(i, "F"), "00")
Else
Cells(i, "K").Value = Format(Cells(i, "B"), "00") & "." & Format(Cells(i, "C"), "0000") & "." & Format(Cells(i, "E"), "00") & "." & Format(Cells(i, "F"), "00")
End If
Next i
Windows("Classeur1.xlsx").Activate
Range("B6").Select
Ici je suis coincé