
Bonjour,
Essaie ceci :
Il est pr?sum? dans la proc?dure que tes temps sont en colonne B:B
'-----------------------------------------------
Sub SaveAsTextFile()
Dim C As Range, Nb As Long
Dim fFilename As String
Dim a As Integer, b As Integer
Dim tmP As String, Sep As String
Sep = ";"
fFilename = "c:\chrono1.txt"
Nb = FreeFile
Open fFilename For Output As Nb
'D?finir la plage de cellules
With Worksheets("Feuil1")
Set C = .Range("A3:C10")
End With
For a = 1 To C.Rows.Count
tmP = ""
For b = 1 To C.Columns.Count
If tmP > "" Then
If C(a, b).Column = 2 Then
If IsDate(C(a, b)) Then
tmP = tmP & Sep & Format(C(a, b), "hh""hh""MM""'""SS")
Else
tmP = tmP & Sep & C(a, b)
End If
Else
tmP = tmP & Sep & C(a, b)
End If
Else
tmP = C(a, b)
End If
Next
Print #Nb, tmP
Next
Close #Nb
End Sub
'-----------------------------------------------
Bonjour,
cette proc?dure fonctionne bien : (merci MichDenis)
Sub SaveAsTextFile()
Dim C As Variant, Nb As Long
Dim fFilename As String
Dim a As Integer, b As Integer
Dim tmP As String, Sep As String
Sep = ";"
fFilename = "c:\chrono1.txt"
Nb = FreeFile
Open fFilename For Output As Nb
'D?finir la plage de cellules
C = Range("b3:C5") ' ? d?finir
For a = 1 To UBound(C, 1)
tmP = ""
For b = 1 To UBound(C, 2)
If tmP > "" Then
tmP = tmP & Sep & C(a, b)
Else
tmP = C(a, b)
End If
Next
Print #Nb, tmP
Next
Close #Nb
End Sub
mais:
- dans la colonne B j'ai des nombres entiers
- dans la colonne C j'ai des temps au format Excel 00:00:00
- la proc me sauvegarde comme ceci par ex:
1;4,88425926596392E-03
et je voudrais obtenir:
1;00hh07'02
Est-il possible d'obtenir cela directement ?
Merci de votre aide.