
Originally Posted by
googs91
its still missing about 1hr and 1 min of data
Argh! I completely missed that!!!
Give this code a try...
Sub FillInMissingTimeSlots()
Dim R As Long, T1 As Date, T2 As Date
Application.ScreenUpdating = False
For R = Cells(Rows.Count, "A").End(xlUp).Row To 5 Step -1
T1 = 60 * Hour(Cells(R - 1, "A").Value) + Minute(Cells(R - 1, "A").Value)
T2 = 60 * Hour(Cells(R, "A").Value) + Minute(Cells(R, "A").Value)
If T2 - T1 > Minute(TimeSerial(0, 1, 0)) Then
Cells(R, "A").Resize(T2 - T1 - 1).EntireRow.Insert
End If
Next
On Error GoTo NoBlanks
With Range("A4", Cells(Rows.Count, "A").End(xlUp))
.SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C+TIME(0,1,0)"
.Value = .Value
End With
NoBlanks:
Application.ScreenUpdating = True
End Sub
Bookmarks