ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Help with Code - TimeValue (https://www.excelbanter.com/excel-programming/278772-need-help-code-timevalue.html)

Donnie Stone

Need Help with Code - TimeValue
 
I need help with the following code. The code as is works great, but I'm
looking for a way to control the TimeValue("00:02:00") based on a value
entered in cell B5 in worksheet1.

Is this doable?

Thanks in advance for the help.

Dim dNext As Date

Sub StartDoingIt()
'calculate when code should run again
dNext = Now + TimeValue("00:02:00")
'set on time event to trigger running
Application.OnTime dNext, "StartDoingIt"
' whatever you want to do
PasteToArchive
End Sub



Dave Peterson[_3_]

Need Help with Code - TimeValue
 
Depending on what was in the cell:

dNext = Now + worksheets("sheet1").range("B5").value

(B5 held a time???)



Donnie Stone wrote:

I need help with the following code. The code as is works great, but I'm
looking for a way to control the TimeValue("00:02:00") based on a value
entered in cell B5 in worksheet1.

Is this doable?

Thanks in advance for the help.

Dim dNext As Date

Sub StartDoingIt()
'calculate when code should run again
dNext = Now + TimeValue("00:02:00")
'set on time event to trigger running
Application.OnTime dNext, "StartDoingIt"
' whatever you want to do
PasteToArchive
End Sub


--

Dave Peterson



All times are GMT +1. The time now is 12:14 PM.

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