• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Countdown timer

zrydersim

New Member
Hi i need help as i couldn't think of the logic for this particular function.

I managed to create a timestamp once i input anything on column A, is there anyway that i could start a timer without a start/stop button? (base on most of the examples, they require a start and stop button)

like once i key in column A, base on the time stamp, begin a timer and prompt a message after 1 min, 3 min and 5 mins ?

would really appreciate any help available :D
 

Attachments

  • sample1.PNG
    sample1.PNG
    8.7 KB · Views: 5
You can place your countdown timer code in the Worksheet_Change event.
Include in your code reference to the column of the time stamp, that way your timer/s won't be initiated every time something is added elsewhere on the sheet.
 
You'll need an alerting macro in a standard code-module like:
Code:
Sub AlertMe(myCell, msg)
  Application.Goto Range(myCell) 'jumps to the relevant cell
  MsgBox msg & " minute(s) gone for row " & Range(myCell).Row 'pops up a message
End Sub
Then the tweak in the Worksheet_Change event will involve adding the likes of:
Code:
  NowPlus0 = Now()
  Application.OnTime NowPlus0 + TimeSerial(0, 0, 5), "'AlertMe """ & Target.Address(external:=True) & """, 1'"
  Application.OnTime NowPlus0 + TimeSerial(0, 0, 10), "'AlertMe """ & Target.Address(external:=True) & """, 3'"
  Application.OnTime NowPlus0 + TimeSerial(0, 0, 15), "'AlertMe """ & Target.Address(external:=True) & """, 5'"
The intervals in the code above are for 5, 10 and 15 seconds (so that testing doesn't take an age). To change them to 1, 3 and 5 minutes change to:
TimeSerial(0, 1, 0)
TimeSerial(0, 3, 0)
TimeSerial(0, 5, 0)
 
Back
Top