I have modified the below functions from an earlier thread to be able to change the frame rate in one spot within the function. I would like to be able to point to a second cell that contains the frame rate while the first cell contains the TC or frames. Not sure how to execute that. The cell would maybe look like [TC2Frames(A1,A2)] with A1 being the TC number and A2 being the Frame rate.
Function TC2Frames(TimeCodeCell As Range) As Long
Dim hh As Long
Dim mm As Long
Dim ss As Long
Dim ff As Long
Dim TimeCodeText As String
Dim FrameRate As Integer
TimeCodeText = TimeCodeCell.Value
FrameRate = 29.97
hh = Mid(TimeCodeText, 1, 2)
mm = Mid(TimeCodeText, 4, 2)
ss = Mid(TimeCodeText, 7, 2)
ff = Mid(TimeCodeText, 10, 2)
TC2Frames = ff + (ss * FrameRate) + (mm * FrameRate * 60) + (hh * FrameRate * 60 * 60)
End Function
Function Frames2TC(NumFramesValue As Long) As String
Dim hh As Long
Dim mm As Long
Dim ss As Long
Dim ff As Long
Dim FrameRate As Integer
FrameRate = 25
hh = Int(NumFramesValue / FrameRate / 60 / 60)
mm = Int((NumFramesValue - (hh * FrameRate * 60 * 60)) / FrameRate / 60)
ss = Int((NumFramesValue - (hh * FrameRate * 60 * 60 + mm * FrameRate * 60)) / FrameRate)
ff = Int(NumFramesValue - (hh * FrameRate * 60 * 60 + mm * FrameRate * 60 + ss * FrameRate))
Frames2TC = Format(hh, "00") & ":" & Format(mm, "00") & ":" & Format(ss, "00") & ":" & Format(ff, "00")
End Function
With this function I can build a Timecode coversion worksheet as well as the difference function from the earlier thread. I think?
Thanks
Function TC2Frames(TimeCodeCell As Range) As Long
Dim hh As Long
Dim mm As Long
Dim ss As Long
Dim ff As Long
Dim TimeCodeText As String
Dim FrameRate As Integer
TimeCodeText = TimeCodeCell.Value
FrameRate = 29.97
hh = Mid(TimeCodeText, 1, 2)
mm = Mid(TimeCodeText, 4, 2)
ss = Mid(TimeCodeText, 7, 2)
ff = Mid(TimeCodeText, 10, 2)
TC2Frames = ff + (ss * FrameRate) + (mm * FrameRate * 60) + (hh * FrameRate * 60 * 60)
End Function
Function Frames2TC(NumFramesValue As Long) As String
Dim hh As Long
Dim mm As Long
Dim ss As Long
Dim ff As Long
Dim FrameRate As Integer
FrameRate = 25
hh = Int(NumFramesValue / FrameRate / 60 / 60)
mm = Int((NumFramesValue - (hh * FrameRate * 60 * 60)) / FrameRate / 60)
ss = Int((NumFramesValue - (hh * FrameRate * 60 * 60 + mm * FrameRate * 60)) / FrameRate)
ff = Int(NumFramesValue - (hh * FrameRate * 60 * 60 + mm * FrameRate * 60 + ss * FrameRate))
Frames2TC = Format(hh, "00") & ":" & Format(mm, "00") & ":" & Format(ss, "00") & ":" & Format(ff, "00")
End Function
With this function I can build a Timecode coversion worksheet as well as the difference function from the earlier thread. I think?
Thanks