Need Help with Code - TimeValue

  • Thread starter Thread starter Donnie Stone
  • Start date Start date
D

Donnie Stone

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
 
Depending on what was in the cell:

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

(B5 held a time???)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Expert Required 1
Run time error 2
automation error 0
Excel Run-time error '1004' General ODBC Error 1
How to assign unit for TimeValue? 20
Adding code 5
Simple Variable to someone 5
Stop timer. 5

Back
Top