Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Calculating Elapsed time in a macro

I have a data stream that is providing time in military format (hh:mm:ss)in
column A begining at row 12, and I want to place elapsed time in column B.
I've been subtracting the values of the cells using A12 as the reference
value, but I'm getting just 0.0

Macro section as follows:
it = Sheets("Data").Cells(12,1).value
at = Sheets("Data").Cells(RowPointer, 1).value
et = at - it
Sheets("Data").Cells(RowPointer,2).Formula = et

(it = initial time, at = actual time, et = elapsed time)

Data would look like:

12:12:00
12:12:30
12:13:00
12:13:30

I need to get
0:00
0:30
1:00
1:30
into the second column, but doing the calculation in the macro, not in the
sheet.

Help! I'm stumped, using Excel 2000 right now.
thanks
Art


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calculating Elapsed time in a macro

Sub AAAAA()
For rowPointer = 13 To 15
With Sheets("Data")
it = .Cells(12, 1).Value
at = .Cells(rowPointer, 1).Value
et = at - it
..Cells(rowPointer, 2).Value = et
..Cells(rowPointer, 2).NumberFormat = "hh:mm:ss"
End With
Next
End Sub

Worked for me.

--
Regards,
Tom Ogilvy



Art D. wrote in message
...
I have a data stream that is providing time in military format

(hh:mm:ss)in
column A begining at row 12, and I want to place elapsed time in column B.
I've been subtracting the values of the cells using A12 as the reference
value, but I'm getting just 0.0

Macro section as follows:
it = Sheets("Data").Cells(12,1).value
at = Sheets("Data").Cells(RowPointer, 1).value
et = at - it
Sheets("Data").Cells(RowPointer,2).Formula = et

(it = initial time, at = actual time, et = elapsed time)

Data would look like:

12:12:00
12:12:30
12:13:00
12:13:30

I need to get
0:00
0:30
1:00
1:30
into the second column, but doing the calculation in the macro, not in the
sheet.

Help! I'm stumped, using Excel 2000 right now.
thanks
Art




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating Elapsed Time Over a Set Period JES Excel Worksheet Functions 2 December 26th 09 05:14 PM
Calculating Elapsed Time Rosemary Excel Worksheet Functions 2 March 23rd 09 03:23 PM
Calculating elapsed time tele2002 Excel Discussion (Misc queries) 2 December 22nd 05 05:47 PM
Calculating Time elapsed bhomer Excel Worksheet Functions 1 November 21st 05 01:16 PM
Calculating elapsed time andoh Excel Worksheet Functions 5 November 17th 05 11:31 AM


All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"