Option Explicit
Function NbImages(ByVal TimeCode As String, ByVal IpS As Integer) As Long
NbImages = Int(TimeValue(Left$(TimeCode, 8)) * 86400 * IpS + 0.5) + Right$(TimeCode, 2)
End Function
Function TimeCode(ByVal NbImages As Long, ByVal IpS As Integer) As String
Dim Excéd As Long
Excéd = NbImages Mod IpS: NbImages = NbImages - Excéd
TimeCode = Format(NbImages / IpS / 86400, "hh:mm:ss") & "|" & Format(Excéd, "00")
End Function
c'est le principe ...Si je comprends qu'il faut séparer le dernier chiffre (celui des images) dans une autre cellule,
Option Explicit
Const convSec As Long = 86400
Function T2i(T, Optional imgs As Long = 25)
' conversion images ou TC "hh:mm:ss:img" en images
' imgs : images par seconde
If T Like "##:[0-5]#:[0-5]#:##" Then
T2i = CDate(Left(T, 8)) * convSec * imgs + CLng(Right(T, 2))
ElseIf IsNumeric(T) Then
T2i = CLng(T)
Else
T2i = CVErr(xlErrValue)
End If
End Function
Function T2TC(ByVal T, Optional imgs As Long = 25)
' conversion images ou TC en TC "hh:mm:ss:img"
' imgs : images par seconde
T = T2i(T, imgs)
T2TC = format(CDate(Int(T / imgs) / convSec), "hh:mm:ss") & ":" & format(T Mod imgs, "00")
End Function
Function TPlus_i(T1, T2, Optional imgs As Long = 25)
' T2+T1 (images ou TC) en images
TPlus_i = T2i(T2, imgs) + T2i(T1, imgs)
End Function
Function TMoins_i(T1, T2, Optional imgs As Long = 25)
' T2-T1 (images ou TC) en images
TMoins_i = T2i(T2, imgs) - T2i(T1, imgs)
End Function
Function TSomme_i(plage As Range, Optional imgs As Long = 25)
' somme des T (images ou TC) en images
Dim c As Range
For Each c In plage
TSomme_i = TPlus_i(TSomme_i, c.Value, imgs)
Next c
End Function
Function TPlus_TC(T1, T2, Optional imgs As Long = 25)
' T2+T1 (images ou TC) en TC "hh:mm:ss:img"
TPlus_TC = T2TC(TPlus_i(T1, T2, imgs), imgs)
End Function
Function TMoins_TC(T1, T2, Optional imgs As Long = 25)
' T2+T1 (images ou TC) en TC "hh:mm:ss:img"
TMoins_TC = T2TC(TMoins_i(T1, T2, imgs), imgs)
End Function
Function TSomme_TC(plage As Range, Optional imgs As Long = 25)
' somme des T (images ou TC) en TC "hh:mm:ss:img"
TSomme_TC = T2TC(TSomme_i(plage, imgs), imgs)
End Function
Option Explicit
Function NbImg(ByVal TCode, Optional ByVal IpS As Integer = 25)
Dim L As Long, C As Long
If TypeOf TCode Is Range Then TCode = TCode.Value
If IsArray(TCode) Then
For L = 1 To UBound(TCode, 1): For C = 1 To UBound(TCode, 2)
TCode(L, C) = NbImages(TCode(L, C), IpS): Next C, L: NbImg = TCode
Else: NbImg = NbImages(TCode, IpS): End If
End Function
Function TCode(ByVal NbImg, Optional ByVal IpS As Integer = 25)
Dim L As Long, C As Long
If TypeOf NbImg Is Range Then NbImg = NbImg.Value
If IsArray(NbImg) Then
For L = 1 To UBound(NbImg, 1): For C = 1 To UBound(NbImg, 2)
NbImg(L, C) = TimeCode(NbImg(L, C), IpS): Next C, L: TCode = NbImg
Else: TCode = TimeCode(NbImg, IpS): End If
End Function
Private Function NbImages(ByVal TimeCode As String, ByVal IpS As Integer) As Long
NbImages = Int(TimeValue(Left$(TimeCode, 8)) * 86400 * IpS + 0.5) + Right$(TimeCode, 2)
End Function
Private Function TimeCode(ByVal NbImages As Long, ByVal IpS As Integer) As String
Dim Excéd As Long
Excéd = NbImages Mod IpS: NbImages = NbImages - Excéd
TimeCode = Format(NbImages / IpS / 86400, "hh:mm:ss") & ":" & Format(Excéd, "00")
End Function
Apparemment ça a l'air d'être une norme, dans votre job, cette utilisation du ':' devant le nombre d'image ?
manipulations via formules :Vu mes connaissances archi-basiques d'Excel (en exagérant à peine, tout juste si je sais faire une addition du contenu de deux cellules (!)
pour résumer mon message est: "S'il vous plaît, quelqu'un aurait-il la formule magique pour calculer un décalage de time code