How to measure time for processing periods?

G

Guest

Does anyone have any suggestions on how to measure time for processing periods?
I get a macro to perform a list of tasks. Before the first task perform, I
would like to add the starting time in cell A1, and After the last task
performed, I would like to add the ending time in cell B1, therefore, after
perform all the task under this macro, I get the starting and ending period,
once, I subtract two periods in cell C1, then I will know how long this macro
takes to finish all the task.
Does anyone have any suggestions on how to write this code for setting
starting and ending time into macro.
Thank for any suggestions
Eric
 
S

squenson via OfficeKB.com

At the beginning of the macro, I would add this line of code (adapt the Sheet
name to your needs):
Range("Sheet1!A1").Value = Now()

At the end, do the same with:
Range("Sheet1!B1").Value = Now()

And in C1: = B1-A1
 
G

Guest

Thank you for your suggestions
In cell A1, it returns 8/15/2007 14:18, do you have any suggestions on how
to display in 12 hr format, such as 2:18 PM? On the hands, once I subtract
both periods and return the value in cell C1, do you have any suggestions on
how to display in minute format, such as 45 mins / 72 mins?
Thank you for any suggestions
Eric
 
D

David Biddulph

For 12 hour format in A1, format as dd/mm/yyyy h:mm AM/PM
For minutes in C1 format as [mm], but if you want to use the number of
minutes in a calculation, use =(B1-A1)*24*60 and format as General or
Number.
 
G

Guest

Thank everyone for your suggestions
Could you give me any suggestions on how to code it in macro?

Range("Sheet1!C3").Value = Text(Now(), "hh:mm AM/PM")
Which does not give a correct coding structure for macro.
Do you have any suggestion?
Thank for any suggestions
Eric

David Biddulph said:
For 12 hour format in A1, format as dd/mm/yyyy h:mm AM/PM
For minutes in C1 format as [mm], but if you want to use the number of
minutes in a calculation, use =(B1-A1)*24*60 and format as General or
Number.
--
David Biddulph

Eric said:
Thank you for your suggestions
In cell A1, it returns 8/15/2007 14:18, do you have any suggestions on how
to display in 12 hr format, such as 2:18 PM? On the hands, once I subtract
both periods and return the value in cell C1, do you have any suggestions
on
how to display in minute format, such as 45 mins / 72 mins?
Thank you for any suggestions
Eric
 
D

Dave Peterson

I'd use something like:

with worksheets("sheet1").range("C3")
.numberformat = "mm/dd/yyyy hh:mm AM/PM"
.value = now
end with


Thank everyone for your suggestions
Could you give me any suggestions on how to code it in macro?

Range("Sheet1!C3").Value = Text(Now(), "hh:mm AM/PM")
Which does not give a correct coding structure for macro.
Do you have any suggestion?
Thank for any suggestions
Eric

David Biddulph said:
For 12 hour format in A1, format as dd/mm/yyyy h:mm AM/PM
For minutes in C1 format as [mm], but if you want to use the number of
minutes in a calculation, use =(B1-A1)*24*60 and format as General or
Number.
--
David Biddulph

Eric said:
Thank you for your suggestions
In cell A1, it returns 8/15/2007 14:18, do you have any suggestions on how
to display in 12 hr format, such as 2:18 PM? On the hands, once I subtract
both periods and return the value in cell C1, do you have any suggestions
on
how to display in minute format, such as 45 mins / 72 mins?
Thank you for any suggestions
Eric
:

At the beginning of the macro, I would add this line of code (adapt the
Sheet
name to your needs):
Range("Sheet1!A1").Value = Now()

At the end, do the same with:
Range("Sheet1!B1").Value = Now()

And in C1: = B1-A1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top