Sub mycopie()
Dim Wb As Workbook
Dim Fichier As Variant
'Dim n As Integer
'n = 0
Debut:
[A2:Z1000].ClearContents
col = Array("", "B", "F", "I", "M", "P", "U", "X", "Z", "AC", "AH", "AI", "AK", "AN")
Fichier = Application.GetOpenFilename("Fichiers .XLS (*.xls),*.xls,Fichier .CSV(*.csv),*.csv")
If Fichier = False Then Exit Sub
Set Wb = GetObject(Fichier)
With Wb.Sheets(1)
lig = .[I14].End(xlDown).Row
For k = 1 To 13
Range(Cells(2, k), Cells(lig, k)).Value = .Range(.Cells(15, col(k)), .Cells(lig + 15, col(k))).Value
Next
[A:A].SpecialCells(xlCellTypeBlanks).EntireRow.Delete 'suppression ligne vide
lig = [C65000].End(3).Row + 3
Range("A" & lig) = "Amplitude:"
Range("B" & lig) = .[H9]
Range("A" & lig + 1) = "Horamètre:"
For k = 2 To lig - 3
tx = Replace(Range("J" & k), "h ", ":")
tx = Replace(tx, "mn ", ":")
tx = Replace(tx, "s", "")
Range("B" & lig + 1) = Range("B" & lig + 1) + TimeValue(tx)
Next
tx = Range("B" & lig + 1)
Range("B" & lig + 1) = Hour(tx) & "h " & Minute(tx) & "mn " & Second(tx) & "s"
'Range("A" & lig + 1) = "Horamètre:"
'Range("B" & lig + 1) = Application.Sum("J2:J1000")
Range("A" & lig + 2) = "Distance:"
Range("B" & lig + 2) = .[O11]
Range("A" & lig + 3) = "Odomètre :"
Range("B" & lig + 3) = .[H11]
Range("A" & lig + 4) = "Arrêt:"
Range("B" & lig + 4) = .[W9]
Range("A" & lig + 5) = "Contact:"
Range("B" & lig + 5) = .[O9]
Range("A" & lig + 6) = "Pause:"
Range("B" & lig + 6) = .[W11]
Range("A" & lig + 7) = "Roulage:"
Range("B" & lig + 7) = .[W10]
Range("A" & lig + 8) = "Moy:"
Range("B" & lig + 8) = .[O10]
Range("A" & lig + 9) = "Vit.Max:"
Range("B" & lig + 9) = .[H10]
ActiveSheet.Name = .[D5]
Range("A1:M1").Copy
If MsgBox("Voulez-Vous ajouter un autre fichier", vbYesNo + vbExclamation, "Question") = vbYes Then
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Cells(1, 1).Select
ActiveSheet.Paste
GoTo Debut
Else: Exit Sub
End If
Wb.Close
End With
End Sub