title: Find and Insert Rows for Missing Timestamps, Remove rows for Unwanted Timestamps
body: <p>I have a huge table containing about 24000 rows of 800 hours of data, where each cell has an interval of 2 minutes. The sample values in table are:</p>
  
  <pre><code>station,  date,             used, free
  1,        5/21/2008 12:00   6     15
  1,        5/21/2008 12:02,  7,    14
  1,        5/21/2008 12:04,  6,    15
  1,        5/21/2008 12:08,  5,    16
  1,        5/21/2008 12:14,  6,    15
  1,        5/21/2008 12:15,  7,    14
  1,        5/21/2008 12:16,  7,    14
  </code></pre>
  
  <p>In the above table, time-stamps for 12:06, 12:10 and 12:12 are missing, while 12:15 should not be there, because every interval should be of 2 minutes.
  I tried the following code provided by rbrhodes at the following link:</p>
  
  <p><a href="https://www.ozgrid.com/forum/forum/help-forums/excel-general/85157-insert-fill-missing-rows-within-sequential-dates-times-list" rel="nofollow noreferrer">https://www.ozgrid.com/forum/forum/help-forums/excel-general/85157-insert-fill-missing-rows-within-sequential-dates-times-list</a></p>
  
  <p>Code:
      Option Explicit</p>
  
  <pre><code>Sub rowinsert()
  
  Dim ThisTime As Double
  Dim NextTime As Double
  Dim cel As Range
  Dim rng As Range
  Dim LastRow As Long
  Dim rval As Variant
  
  'Speed
  Application.ScreenUpdating = False
  
  'Get last row of data
  LastRow = Range("B" &amp; Rows.Count).End(xlUp).Row
  
  'Where to look
  Set rng = Range("B1:B" &amp; LastRow)
  
  'Chek all
  For Each cel In rng
  'Check if done
  If cel.Offset(1, 0) = vbNullString Then GoTo endo
  'Add 15 mins to cell value
  ThisTime = Round((cel + TimeValue("00:02:00")) * 24 * 30) / 30 / 24
  'Get next cel time
  NextTime = Round(cel.Offset(1, 0) * 24 * 30) / 30 / 24
  'Check if time is + 2
  If ThisTime &lt;&gt; NextTime Then
  'No. Insert a row
  cel.Offset(1, 0).EntireRow.Insert shift:=xlDown
  'Put next req'd time
  cel.Offset(1, 0) = ThisTime
  'Put 'N/A'
  Range(cel.Offset(1, 1), cel.Offset(1, 2)) = "N/A"
  End If
  Next
  
  endo:
  
  'Cleanup
  Set cel = Nothing
  Set rng = Nothing
  
  'Reset
  Application.ScreenUpdating = True
  
  End Sub
  </code></pre>
  
  <p>It is working perfectly fine for missing values. but if there are timestamps in sequence like 12:14, 12:15, 12:16, then that code is not working.</p>
  
  <p>I need to modify the code to delete the rows which contains "odd" timestamps.
  This my first time experience with VBA. Any help would be highly appreciated.
  Thanks.</p>