Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Real-time clock in excel

Hi all,
I have used the following VBA code to have the real time clock in one of my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Real-time clock in excel

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in one of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Real-time clock in excel

Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not showing up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in one of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Real-time clock in excel

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Real-time clock in excel

Hi Bob,
how should I run the clock procedure to get it started in excel, as you see
the VBA code I have pasted is not working please help me, thanks.

Daoud Fakhry


"Bob Phillips" wrote:

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub









  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Real-time clock in excel

You could either add a button that starts it, assigning that procedure to
the button, or start it when the workbook opens. You already have a nice
easy way to stop it, by putting an X in B1. On that basis, a button sounds
best, you could even have another macro that clears B1 and runs clock
assigned to that button, that way you can easily restart it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
how should I run the clock procedure to get it started in excel, as you
see
the VBA code I have pasted is not working please help me, thanks.

Daoud Fakhry


"Bob Phillips" wrote:

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not
showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in
one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub









  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Real-time clock in excel

Hi Bob,
I modefied the VBA code as following, the clock is not running again I might
miss something please help me.

Private Sub workbook_open()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub

Thanks, DF

"Bob Phillips" wrote:

You could either add a button that starts it, assigning that procedure to
the button, or start it when the workbook opens. You already have a nice
easy way to stop it, by putting an X in B1. On that basis, a button sounds
best, you could even have another macro that clears B1 and runs clock
assigned to that button, that way you can easily restart it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
how should I run the clock procedure to get it started in excel, as you
see
the VBA code I have pasted is not working please help me, thanks.

Daoud Fakhry


"Bob Phillips" wrote:

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not
showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in
one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub










  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Real-time clock in excel

Did you put the code in ThisWorkbook, then shut and open the workbook?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I modefied the VBA code as following, the clock is not running again I
might
miss something please help me.

Private Sub workbook_open()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub

Thanks, DF

"Bob Phillips" wrote:

You could either add a button that starts it, assigning that procedure to
the button, or start it when the workbook opens. You already have a nice
easy way to stop it, by putting an X in B1. On that basis, a button
sounds
best, you could even have another macro that clears B1 and runs clock
assigned to that button, that way you can easily restart it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
how should I run the clock procedure to get it started in excel, as you
see
the VBA code I have pasted is not working please help me, thanks.

Daoud Fakhry


"Bob Phillips" wrote:

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not
showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in
my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in
one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit
Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now,
"hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub












  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 41
Default Real-time clock in excel

Bob,
I have pasted this code to This Workbook in VAB page. I have closed the
workbook and then reopened it, I have the following message on my screen.

"The macro "C:\Documents and Settings\dfakhry\desktop\clocl.xls'!clock
cannot be found"

the above address is where I have my workbook saved.let me know if I am
missing something in the code.
Thanks,

"Bob Phillips" wrote:

Did you put the code in ThisWorkbook, then shut and open the workbook?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I modefied the VBA code as following, the clock is not running again I
might
miss something please help me.

Private Sub workbook_open()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now, "hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub

Thanks, DF

"Bob Phillips" wrote:

You could either add a button that starts it, assigning that procedure to
the button, or start it when the workbook opens. You already have a nice
easy way to stop it, by putting an X in B1. On that basis, a button
sounds
best, you could even have another macro that clears B1 and runs clock
assigned to that button, that way you can easily restart it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
how should I run the clock procedure to get it started in excel, as you
see
the VBA code I have pasted is not working please help me, thanks.

Daoud Fakhry


"Bob Phillips" wrote:

As I said, you have to run the clock procedure to get it started.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Daoud Fakhry" wrote in message
...
Hi Bob,
I put the code in a module.
B1 doesn't have the X value.
I just put this code in a module and that is it.
I mean that the clock in sheet1 A1 is not working, even it is not
showing
up.

Thanks for your help in advance.

"Bob Phillips" wrote:

Is clock in a standard module (it should be)?

Does B1 have the value X (it shouldn't, except to stop the clock)?

Do you fire the procedure initially somehow?

What does not working mean?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in
my
addy)

"Daoud Fakhry" wrote in message
...
Hi all,
I have used the following VBA code to have the real time clock in
one
of
my
cells. but it is not working. can any one help me.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("B1").Value = "X" Then Exit
Sub
ThisWorkbook.Worksheets(1).Range("A1").Value = Format(Now,
"hh:mm:ss
AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 1), "clock"
End Sub













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
how do i insert a real time clock in excel ? daredevilzx9 Excel Discussion (Misc queries) 3 June 27th 07 12:31 PM
Change EXCEL Clock to Standard Clock or Military Time YoMarie Excel Worksheet Functions 4 April 29th 07 08:39 PM
Convert real time to a % in Excel barry Excel Discussion (Misc queries) 1 August 1st 06 10:25 AM
can excel be a time clock or stop watch? Anthony Reynard Chinnis New Users to Excel 1 February 15th 06 06:51 AM
Calculating Clock start time in Excel Hani Muhtadi Excel Discussion (Misc queries) 1 August 31st 05 10:01 PM


All times are GMT +1. The time now is 01:24 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"