Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Time Macro Issue

Dear Expert,
I asked for this question before.
Someone asked me to refer to this path.
http://www.brainbell.com/tutorials/m...A_Set_Time.htm
I did it ....
I even tried to prepare similar marco in my Excel.
Save these 2 macros in a file called TimeMarco.Xls
The scripts (task) is meaningless ... Just type as a test.
I open this file TimeMarco.xls
But it works sometimes ... it does not work sometimes ....
I am using Excel 2000.
How I can make it work all the time ?
Thanks ...


Private Sub Workbook_Open()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

End Sub

Sub MyMacro()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

Application.Goto Reference:="R1C1"
ActiveCell.FormulaR1C1 = "I love you"
Range("A1").Select
Selection.Copy
Range("A2:A18").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C1").Select
ActiveCell.FormulaR1C1 = "I hatee you"
Range("C1").Select
Selection.Copy
Range("C2:C11").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E1").Select
ActiveCell.FormulaR1C1 = "I look €¦€¦€¦"
Range("E2").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Time Macro Issue

Chip Pearson has lots of info he
http://www.cpearson.com/excel/OnTime.aspx

Elton Law wrote:

Dear Expert,
I asked for this question before.
Someone asked me to refer to this path.
http://www.brainbell.com/tutorials/m...A_Set_Time.htm
I did it ....
I even tried to prepare similar marco in my Excel.
Save these 2 macros in a file called TimeMarco.Xls
The scripts (task) is meaningless ... Just type as a test.
I open this file TimeMarco.xls
But it works sometimes ... it does not work sometimes ....
I am using Excel 2000.
How I can make it work all the time ?
Thanks ...

Private Sub Workbook_Open()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

End Sub

Sub MyMacro()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

Application.Goto Reference:="R1C1"
ActiveCell.FormulaR1C1 = "I love you"
Range("A1").Select
Selection.Copy
Range("A2:A18").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C1").Select
ActiveCell.FormulaR1C1 = "I hatee you"
Range("C1").Select
Selection.Copy
Range("C2:C11").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E1").Select
ActiveCell.FormulaR1C1 = "I look €¦€¦€¦"
Range("E2").Select

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Time Macro Issue

Hi Dave,
I did see this web before.

Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "TheSub" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub

Sub TheSub()
''''''''''''''''''''''''
' Your code here
''''''''''''''''''''''''
StartTimer ' Reschedule the procedure
End Sub


Can you tell me how to type the starting time rather than "now" please?




"Dave Peterson" wrote:

Chip Pearson has lots of info he
http://www.cpearson.com/excel/OnTime.aspx

Elton Law wrote:

Dear Expert,
I asked for this question before.
Someone asked me to refer to this path.
http://www.brainbell.com/tutorials/m...A_Set_Time.htm
I did it ....
I even tried to prepare similar marco in my Excel.
Save these 2 macros in a file called TimeMarco.Xls
The scripts (task) is meaningless ... Just type as a test.
I open this file TimeMarco.xls
But it works sometimes ... it does not work sometimes ....
I am using Excel 2000.
How I can make it work all the time ?
Thanks ...

Private Sub Workbook_Open()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

End Sub

Sub MyMacro()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

Application.Goto Reference:="R1C1"
ActiveCell.FormulaR1C1 = "I love you"
Range("A1").Select
Selection.Copy
Range("A2:A18").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C1").Select
ActiveCell.FormulaR1C1 = "I hatee you"
Range("C1").Select
Selection.Copy
Range("C2:C11").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E1").Select
ActiveCell.FormulaR1C1 = "I look €¦â‚¬Â¦Ã¢‚¬Â¦"
Range("E2").Select

End Sub


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Time Macro Issue

Sub StartTimer()
RunWhen = TimeSerial(19,13,30)
....

Remember if you don't want the timer reset (just run the macro once), then don't
call the starttimer at the end of the TheSub procedure.

Elton Law wrote:

Hi Dave,
I did see this web before.

Public RunWhen As Double
Public Const cRunIntervalSeconds = 120 ' two minutes
Public Const cRunWhat = "TheSub" ' the name of the procedure to run

Sub StartTimer()
RunWhen = Now + TimeSerial(0,0,cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _
Schedule:=True
End Sub

Sub TheSub()
''''''''''''''''''''''''
' Your code here
''''''''''''''''''''''''
StartTimer ' Reschedule the procedure
End Sub

Can you tell me how to type the starting time rather than "now" please?

"Dave Peterson" wrote:

Chip Pearson has lots of info he
http://www.cpearson.com/excel/OnTime.aspx

Elton Law wrote:

Dear Expert,
I asked for this question before.
Someone asked me to refer to this path.
http://www.brainbell.com/tutorials/m...A_Set_Time.htm
I did it ....
I even tried to prepare similar marco in my Excel.
Save these 2 macros in a file called TimeMarco.Xls
The scripts (task) is meaningless ... Just type as a test.
I open this file TimeMarco.xls
But it works sometimes ... it does not work sometimes ....
I am using Excel 2000.
How I can make it work all the time ?
Thanks ...

Private Sub Workbook_Open()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

End Sub

Sub MyMacro()

Application.OnTime TimeValue("19:13:40"), "MyMacro"

Application.Goto Reference:="R1C1"
ActiveCell.FormulaR1C1 = "I love you"
Range("A1").Select
Selection.Copy
Range("A2:A18").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C1").Select
ActiveCell.FormulaR1C1 = "I hatee you"
Range("C1").Select
Selection.Copy
Range("C2:C11").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E1").Select
ActiveCell.FormulaR1C1 = "I look €¦â‚¬Â¦Ã¢‚¬Â¦"
Range("E2").Select

End Sub


--

Dave Peterson


--

Dave Peterson
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
Time issue MJKelly Excel Programming 6 November 19th 08 12:30 PM
Mac issue with macro recording user login & date (run time error ' Linking to specific cells in pivot table Excel Programming 5 May 8th 07 04:52 PM
Military Time Issue vldavis809 Excel Discussion (Misc queries) 5 August 14th 06 08:05 PM
Macro Issue - Run time error 1004 Matt7102 Excel Discussion (Misc queries) 1 December 22nd 05 12:35 AM
Run Time Issue Steph[_3_] Excel Programming 2 May 27th 04 08:07 PM


All times are GMT +1. The time now is 06:36 AM.

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"