Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 -- Message posted via http://www.officekb.com |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 "squenson via OfficeKB.com" wrote: 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 -- Message posted via http://www.officekb.com |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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" wrote in message ... 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 "squenson via OfficeKB.com" wrote: 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 |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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" wrote: 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" wrote in message ... 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 "squenson via OfficeKB.com" wrote: 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 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'd use something like:
with worksheets("sheet1").range("C3") .numberformat = "mm/dd/yyyy hh:mm AM/PM" .value = now end with Eric wrote: 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" wrote: 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" wrote in message ... 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 "squenson via OfficeKB.com" wrote: 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 -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank everyone for suggestions
Eric |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Processing Time | Excel Worksheet Functions | |||
measure calculation time for multiplication of two matrices | Excel Worksheet Functions | |||
Want to measure macro elapsed time. | Excel Discussion (Misc queries) | |||
periods of time | New Users to Excel | |||
I need to measure hours between two events(time/date) to give me . | Excel Worksheet Functions |