Sub hum()
Dim Chemin As String, c As Range, d As Range
Application.ScreenUpdating = False
Chemin = [COLOR="red"]"C:\Test"[/COLOR] [COLOR="seagreen"]' A Adapter[/COLOR]
If Len(Dir(Chemin, vbDirectory)) = 0 Then MkDir Chemin
Set c = Range("C2")
Do While c <> "" [COLOR="seagreen"]'Boucle sur chaque ligne[/COLOR]
If Len(Dir(Chemin & "\" & c & ".xls")) = 0 Then
Application.Workbooks.Add [COLOR="seagreen"]'Création du fichier s'il n'existe pas[/COLOR]
ActiveWorkbook.SaveAs Chemin & "\" & c & ".xls"
Workbooks([COLOR="red"]"Test3.xls"[/COLOR]).Sheets([COLOR="red"]"Feuil1"[/COLOR]).Rows("1:1").Copy Destination:=ActiveWorkbook.Sheets(1).Rows("1:1")
ActiveWorkbook.Sheets(1).Columns("C:C").Delete
Else
Application.Workbooks.Open Chemin & "\" & c & ".xls" [COLOR="seagreen"]'Ou ouverture s'il existe[/COLOR]
End If
Set d = ActiveWorkbook.Sheets(1).Range("A65536").End(xlUp).Offset(1, 0)
[COLOR="seagreen"]'Copie des données utiles[/COLOR]
d = c(1, -1)
d(1, 2) = c(1, 0)
d(1, 3) = c(1, 2)
d(1, 4) = c(1, 3)
ActiveWorkbook.Close True [COLOR="seagreen"]'Fermeture du fichier avec sauvegarde[/COLOR]
Set c = c(2, 1)
Loop
Application.ScreenUpdating = True
End Sub