I have lots of data that is recoreded every 15 minutes in the form
Day HR 15 Min Increm
1 1 15
1 1 30
1 1 45
1 1 60
1 2 15
etc

I have "holes" in my data and want to populate those holes with a row and the day, hour and increment.

I think I am using the insert row statement wrong or my If statement is messed up because when I run it now, it inserts 2976 blank rows and then writes one row with
31 24 60

which should be the last line.

Here is my code: Any hints would be appreciated.

Application.ScreenUpdating = False
Set basebook = ThisWorkbook
I = 1
J = 1
x = 1
rnum = 2
numDAY = 1
numHR = 1
numMIN = 15

For I = 1 To 31
For J = 1 To 24
For x = 1 To 4
If (Val(basebook.Worksheets(1).Cells(rnum, 1).Value) = numDAY And Val(basebook.Worksheets(1).Cells(rnum, 2).Value) = numHR And Val(basebook.Worksheets(1).Cells(rnum, 3).Value) = numMIN) Then

rnum = rnum + 1
numMIN = numMIN + 15
Else

Cells(rnum + 1).EntireRow.Insert
basebook.Worksheets(1).Cells(rnum + 1, 1).Value = numDAY
basebook.Worksheets(1).Cells(rnum + 1, 2).Value = numHR
basebook.Worksheets(1).Cells(rnum + 1, 3).Value = numMIN
rnum = rnum + 1
numMIN = numMIN + 15
End If
Next x
numMIN = 15
numHR = numHR + 1
Next J
numHR = 1
numDAY = numDAY + 1
Next I
End Sub