So, I've made a small loop formula to process some data;
Sub testtosortdata()
Rows(1).Delete
Range("N:O").NumberFormat = "hh:mm:ss"
Dim counter As Integer
counter = 1
Do Until ThisWorkbook.Sheets("sheet4").Cells(counter, 14).Value = ""
'set loop with empty cell ending
Dim value1 As Date
value1 = Range("N" & (counter + 1)).Value
Dim value2 As Date
xvalue2 = Range("ON" & counter).Value
Dim value3 As Date
value3 = value2 - value1
ThisWorkbook.Sheets("sheet4").Range("O" & counter).Value = value2 - value1
counter = counter + 1
Range("O").NumberFormat = "hh:mm:ss"
Loop
End Sub
It works off an imported table, and once the row is deleted is it dates.
I have a small issue.
value1 is a date, and time.
value 2 is a date, and time.
I want to copy over the time only, but so far despite whatever formatting I seem to throw at it, it either makes the value it as -4xxxxxx.xxx, depending on the date.
I basically need to work out the different in minutes between the two times, ignorant of date since the dates will always be the same day.
Any ideas?
Sub testtosortdata()
Rows(1).Delete
Range("N:O").NumberFormat = "hh:mm:ss"
Dim counter As Integer
counter = 1
Do Until ThisWorkbook.Sheets("sheet4").Cells(counter, 14).Value = ""
'set loop with empty cell ending
Dim value1 As Date
value1 = Range("N" & (counter + 1)).Value
Dim value2 As Date
xvalue2 = Range("ON" & counter).Value
Dim value3 As Date
value3 = value2 - value1
ThisWorkbook.Sheets("sheet4").Range("O" & counter).Value = value2 - value1
counter = counter + 1
Range("O").NumberFormat = "hh:mm:ss"
Loop
End Sub
It works off an imported table, and once the row is deleted is it dates.
I have a small issue.
value1 is a date, and time.
value 2 is a date, and time.
I want to copy over the time only, but so far despite whatever formatting I seem to throw at it, it either makes the value it as -4xxxxxx.xxx, depending on the date.
I basically need to work out the different in minutes between the two times, ignorant of date since the dates will always be the same day.
Any ideas?