ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to write a macro to get the system time in excel 97 (https://www.excelbanter.com/excel-discussion-misc-queries/22706-how-write-macro-get-system-time-excel-97-a.html)

Raj

How to write a macro to get the system time in excel 97
 


Dave Peterson

Option Explicit
Sub testme()

MsgBox Now
MsgBox Date
MsgBox Format(Now, "hh:mm:ss")

End Sub


Raj wrote:

--

Dave Peterson

Mexage

You can also use the formulas directly into the cell:

=Date()
for Just the date

=Now()
for Date and time

and

=Now()-Date()
for just the time
"Raj" wrote:



Don Guillett

From now on - Do NOT put your question in the subject line. Put a meaningful
subject line such as "sytem time" and ask your question in the BODY of the
message.

Sub gettime()
MsgBox Time
End Sub

--
Don Guillett
SalesAid Software

"Raj" wrote in message
...




Mexage

I suggest that we act politely, and instead of giving orders we orientate
people.

:-) Have a nice day!

"Don Guillett" wrote:

From now on - Do NOT put your question in the subject line. Put a meaningful
subject line such as "sytem time" and ask your question in the BODY of the
message.

Sub gettime()
MsgBox Time
End Sub

--
Don Guillett
SalesAid Software

"Raj" wrote in message
...





Don Guillett

We have been doing that in MANY posts and yet the problem persists. Those
that insist will probably not get much in the way of answers.

--
Don Guillett
SalesAid Software

"Mexage" wrote in message
...
I suggest that we act politely, and instead of giving orders we orientate
people.

:-) Have a nice day!

"Don Guillett" wrote:

From now on - Do NOT put your question in the subject line. Put a

meaningful
subject line such as "sytem time" and ask your question in the BODY of

the
message.

Sub gettime()
MsgBox Time
End Sub

--
Don Guillett
SalesAid Software

"Raj" wrote in message
...







David McRitchie

Depends on what you are looking for as the system time.
VBA time functions Now, Time include truncated seconds.
The VBA timer function about the same though it differs on PC and MAC
PC version really only attempts to show seconds. (on a PC it show .0 or .5 seconds).

The Excel NOW Worksheet Function is accurate to 10ms.

For a comparison of the Date and Time worksheet functions to the
VBA functions (I am using Excel 2000) see
http://www.mvps.org/dmcritchie/excel...htm#comparison

If you are interested in timing something see
http://www.mvps.org/dmcritchie/excel/slowresp.htm#timer
based on
"How To Use QueryPerformanceCounter to Time Code"
http://support.microsoft.com/kb/172338/EN-US/

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Raj" wrote .
(question was missing as already mentioned)




All times are GMT +1. The time now is 07:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com