Elapsed time over 24 hours

Equalla

New Member
Joined
Mar 18, 2011
Messages
2
Excell 2007 VB Ver 6.5
I have a col with time in 1904 date format.
I have a col with monitored criteria, if this criteria falls below a certain level then I wish to know the time difference between the current cell row time and the current cell -1 row.
The only problem occurs when the time in the current cell is 00:00:17, and the time in the current cell-1 row is 23:55:17.
What I would like to do is paste the formula
'=Mod ((Current cell) -(Current Cell-1),1)'
into another cell, but every time I try to do it I get 'Application-defined or Object-Defined error'
Here is the code I have been using
For x = 4 To 19
y = x + 56
For counter = 3 To C Step 1 'Starts at row 3
Set curcell = Worksheets("All data").Cells(counter, x) ' Starts at Column D
curcell.Select
If curcell >= -30 Then
ActiveCell.Interior.ColorIndex = 3 'Highlights cell red
Z = counter - 1
Cells(counter, y) = "= mod (B" & counter & "-B" & Z & ",1)" 'Subtracts previous time from counter time

End If
Next counter
Next x
 
Last edited:

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Equalla

New Member
Joined
Mar 18, 2011
Messages
2
Sorry figured out the answer myself.

Cells(counter,y).formula ="=Mod(" & v & "-" & w & ",1)"

Where v = "B" & counter
and w = "B" & z
 

Watch MrExcel Video

Forum statistics

Threads
1,109,041
Messages
5,526,416
Members
409,701
Latest member
nitmani

This Week's Hot Topics

Top