View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
imda14u imda14u is offline
external usenet poster
 
Posts: 3
Default minutes aren't minutes?

Hi all,


I have long list of measurement timings with an interval of 10 minutes.

Like this:

time measure
1-1-2008 0:00 120
1-1-2008 0:10 117
1-1-2008 0:20 118

and so on for a whole month.

Sometimes however, there's a gap in time greater than 10 minutes.
I need to fill that gap with the missing time and also add NA for the
measure column. So I wrote the following rather straightforward code:

Sub fillmissing()
' create a gap of 10 minutes
difference = 1 / 24 / 6

Range("a2").Select
Do Until ActiveCell.Text = ""
jump = ActiveCell.Offset(1, 0).Value - ActiveCell.Value
If jump = dfference Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1 / 24 / 6
ActiveCell.Offset(0, 1).Formula = "=NA()"

End If
Loop
End Sub

But, somehow Excel finds 10 minutes unequal to 1/24/6
So, when i run the code i end up with a long list of new gaps of 10
minutes and a NA value in the second column.

I can't put my finger on it.

Does anybody have any suggestions?

Thanks in advance,


Sybolt