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:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,028
Messages
5,856,932
Members
431,840
Latest member
simplysoph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top