Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Time macro based on the value in cell
Dear Expert,
Currently, I am running a time macro ... I have to change the time in VB script. Is it pssible for me to set the time in cell E2 and then run the time maco based on the value in cell E2 ? Thanks Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeSerial(3, 30, 0) Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Time macro based on the value in cell
Try this:
Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote in message ... Dear Expert, Currently, I am running a time macro ... I have to change the time in VB script. Is it pssible for me to set the time in cell E2 and then run the time maco based on the value in cell E2 ? Thanks Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeSerial(3, 30, 0) Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Time macro based on the value in cell
Hi Friend,
Error message comes on this script .... It turns yellow .... RunWhen = TimeValue(Range("E2").Value) Can you help again ? Thanks Elton "JLGWhiz" wrote: Try this: Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote in message ... Dear Expert, Currently, I am running a time macro ... I have to change the time in VB script. Is it pssible for me to set the time in cell E2 and then run the time maco based on the value in cell E2 ? Thanks Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeSerial(3, 30, 0) Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Time macro based on the value in cell
Format cell E2 as text.
Sub test() Range("E2").NumberFormat = "@" CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote: Hi Friend, Error message comes on this script .... It turns yellow .... RunWhen = TimeValue(Range("E2").Value) Can you help again ? Thanks Elton "JLGWhiz" wrote: Try this: Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote in message ... Dear Expert, Currently, I am running a time macro ... I have to change the time in VB script. Is it pssible for me to set the time in cell E2 and then run the time maco based on the value in cell E2 ? Thanks Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeSerial(3, 30, 0) Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Time macro based on the value in cell
Wonderful !!!! Make it ... Thanks so much !
"JLGWhiz" wrote: Format cell E2 as text. Sub test() Range("E2").NumberFormat = "@" CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote: Hi Friend, Error message comes on this script .... It turns yellow .... RunWhen = TimeValue(Range("E2").Value) Can you help again ? Thanks Elton "JLGWhiz" wrote: Try this: Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeValue(Range("A1").Value) '<<Range to use??? Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub "Elton Law" wrote in message ... Dear Expert, Currently, I am running a time macro ... I have to change the time in VB script. Is it pssible for me to set the time in cell E2 and then run the time maco based on the value in cell E2 ? Thanks Sub StartTimer() CreateObject("WScript.Shell").Popup "Macro is going to run on scheduled time.", 2, "Thank you very much for your cooperation" RunWhen = TimeSerial(3, 30, 0) Application.OnTime EarliestTime:=RunWhen, Procedu=cRunWhat, _ Schedule:=True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Running a macro based on the time | Excel Discussion (Misc queries) | |||
Run Macro Based On Time | Excel Worksheet Functions | |||
Run macro based on time | Excel Worksheet Functions | |||
Time based macro | Excel Programming | |||
Time based macro | Excel Programming |