I'm trying to (over)write to a cell as I iterate through a loop but keep getting an error. Any ideas? I want to write the variable g to cells(i,1) and its a string... the function is to amend erroeous video time codes that hae gone over 24hr clock, eg 25:00:00:00 is 01:00:00:00 (hh:min:sec:frames)
Function timechanger()
Dim a, i As Integer
a = Application.WorksheetFunction.CountA(Range("A:A")) - 1
Dim x, y As Variant
For i = 4 To (a + 3)
x = Cells(i, 1).Text
Dim b, e, f, g As String
Dim c, d As Integer
b = Left(x, 2)
c = Int(b)
d = (c Mod 24)
e = Right(x, 9)
f = Application.WorksheetFunction.Text(d, "00")
g = f & e
Sheet2.Range(Cells(i, 1)).Text = g
Next i
End Function