Dim compte
Dim compte1
Dim i
Dim j
Sub TextToNumber()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks.Open("E:\sem20-25.xls")
Windows("sem20-25.xls").Activate
Set ws = wb.Worksheets(1)
Dim nbprobleme As Integer 'new
nbprobleme = 0 'new
With Sheets("MachineInfoCnc")
c = Range("C65536").End(xlUp).Row
Range("C15:C" & c).Select
Selection.TextToColumns Destination:=Range("C15"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End With
compte = 0
i = Range("C65536").End(xlUp).Row + 1
j = 0
'MsgBox i
For Each rw In Sheets("MachineInfoCnc").Rows
j = j + 1
'MsgBox j
If j = i Then Exit Sub
If j < 14 Then GoTo line1
If IsNumeric(rw.Cells(1, 3)) Then
If rw.Cells(1, 3).NumberFormat = "h:mm:ss" Then
compte1 = rw.Cells(1, 3).Value
compte = compte1 + compte
End If
Else
nbprobleme = nbprobleme + 1 'new
GoTo line1
End If
If rw.Cells(1, 2).Value = "Count" Then
rw.Cells(1, 18).Value = compte
rw.Cells(1, 18).NumberFormat = "h:mm:ss"
If nbprobleme > 0 Then rw.Cells(1, 19).Value = nbprobleme & " problème(s)" 'new
compte = 0
nbprobleme = 0 'new
'Windows("sem20-25.xls").Activate
'Columns("R:R").Select
'Selection.AutoFilter Field:=1, Criteria1:="10", Operator:=xlTop10Items
'Columns("R:S").Copy
'Windows("Découpe plasma.xls").Activate
'Columns("K:K").Select
'ActiveSheet.Paste
'Range("K2:L6").Select
'Application.CutCopyMode = False
'Selection.Copy
'Range("C53").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
'Windows("sem20-25.xls").Activate
'Selection.AutoFilter Field:=1
'Rows("10:10").Select
'Application.CutCopyMode = False
'Selection.Delete Shift:=xlUp
'Rows("11:11").Select
'Selection.Delete Shift:=xlUp
'Windows("Découpe plasma.xls").Activate
'Sheets("fiche de saisie").Range("K2:L5").Delete
'Application.CutCopyMode = False
End If
line1:
Next rw
End Sub