How to Create Timer-Counter Using Excel VBA

Поділитися
Вставка
  • Опубліковано 15 вер 2024
  • Our Excel training videos on UA-cam cover formulas, functions and VBA. Useful for beginners as well as advanced learners. New upload every Thursday.
    For details you can visit our website:
    www.exceltrain...
    The idea of this video is not only to learn how to create a timer that doubles as a counter but also to learn some more interesting features and benefits of Excel VBA for automation.
    For more knowledge read the book Excel 2016 Power Programming with VBA: amzn.to/2kDP35V
    If you are from India you can get this book here: amzn.to/2jzJGqU

КОМЕНТАРІ • 88

  • @Exceltrainingvideos
    @Exceltrainingvideos  11 років тому +1

    Thanks for motivating!

  • @Exceltrainingvideos
    @Exceltrainingvideos  11 років тому +1

    You can try for example:
    Range("A1").NumberFormat = "[h]:mm:ss.000"
    This would format Range("A1") in the required way.
    Note for the milliseconds a '.' is used!

  • @RaghavaShine
    @RaghavaShine 9 років тому

    Thank you for the VBA class, it was very useful, Keep doing... All the Best

  • @Testing_QualityAnalyst_Channel
    @Testing_QualityAnalyst_Channel 8 років тому

    Thankyou Dinesh Sir your videos are very useful for me

  • @Cadrieldur
    @Cadrieldur 8 років тому +1

    Thank you so much for the simplicity of the video.

  • @nadiaregli6522
    @nadiaregli6522 9 років тому

    Loved the video and help me so much! Thankyou Dinesh!

  • @venugopalb8181
    @venugopalb8181 8 років тому +1

    Hi Sir,
    Thanks for helping us with simplified codes.
    Could you please help me on how to make real time Analog clock in user form with VBA code. (which contains Hours, Minutes and Seconds hand)

  • @tihenry2k
    @tihenry2k 11 років тому

    You did a great job with ur program....please I would like you to help me. I made a program using your codes but I would like to add the milliseconds on it..I would be very happy if you explain me how to do it basing on your code...Thank you

  • @ricro880
    @ricro880 4 роки тому

    Thank for your helpful explanations . From your previous clip I learnt how to create a count down timer. I am having difficulty replicating this timer in several sheets in the same work book. When I try repeating the process say in sheet2 an ambiguity error comes up. Many thanks. Rick

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Please share your code here in the comments section for a sheet in which the code doesn't work.

  • @akshaydey6143
    @akshaydey6143 6 років тому

    wow.. i like this.. most simplest code used ...

  • @Exceltrainingvideos
    @Exceltrainingvideos  11 років тому

    Did you use Schedule: =False?

  • @1973rugger
    @1973rugger 11 років тому

    Thank you.
    Very well done.

  • @mohamedhassn9652
    @mohamedhassn9652 7 років тому

    thanks for your effort
    i'd like to know how to make elapsed time from timer-counter - on working

  • @Killy369
    @Killy369 8 років тому

    MUCHAS GRACIAS! excelente video muy bien explicado

  • @sodisaperedinonsaper
    @sodisaperedinonsaper 11 років тому

    Thank you very much this is the tutorial I was looking for...I precisely followed your instructions, but when I click the Stop button...appears this error. How can I repair?
    Run-time error '1004':
    Method 'OnTime' of object'_Application' failed

  • @jastak
    @jastak 10 років тому

    excellent video!

  • @missokae32
    @missokae32 7 років тому

    Good Day! Mr.Dinesh Kumar Takyar
    Your video is very useful for me to adjust my work creation ! , Could i have a some question ? :
    For now I have a project time observation process , In the work process have i need to know the method or code to do like a " Multi Section " in one worksheet such as i put the process step 1 , 2 , 3 row by row and i need to Crate time counter by row . Could you please to suggest me.
    P.s. I'm newbie for VBA knowledge . Thanks you

  • @Exceltrainingvideos
    @Exceltrainingvideos  11 років тому

    Check the spelling of Schedul --> Schedule

  • @MyQuimo
    @MyQuimo 10 років тому

    hi Dinesh, Do you have video for the decrement count, I will enter a time that he will count backward until zero.

  • @mickbro89
    @mickbro89 7 років тому

    Have been searching multiple forums today trying to work this out. This is nearly perfect for what I need. Just one quick question:
    If I wanted to display the timer say on a form by way of a label or text box and have the caption of the label update, instead of a cell in the Workbook, what should I use. Is it simply a matter of replacing the Range("A3").Value with something like Label11.Value?

    • @Exceltrainingvideos
      @Exceltrainingvideos  7 років тому

      You can transfer the values from Range("A1"), for example, to a TextBox on a user-form. But it requires some coding tricks.

  • @drdrkarr
    @drdrkarr 9 років тому

    Dinesh, your video on "How to Create Timer-Counter Using Excel VBA" worked perfectly for my application. I have run into a conflict between a Combo box on the same form which undesirably functions as a pause button for the timer when I activate the Combo box. As soon as I have made the selection from the dropdown list, the timer comes back to life and starts where it left off when it stopped. So I am not getting an accurate measure of the total time elapsed since starting the timer, because I lose a few seconds each time I activate the Combo box. Any help will be greatly appreciated. Thanks much in advance for your expertise.
    Dr. Donald Karr

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      Donald Karr You could create a start and stop timer-button. You would stop the timer, select the item from the combo-box and again start the timer.
      Hope this helps.

  • @inKannada
    @inKannada 9 років тому

    Hello Dinesh, i need to create Start, Pause and Stop time buttons in excel, could you please provide any videos on this topic. it would be very helpful. Thank you.

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      Abdul Rehman Did you have a look at these videos?Timer in Excel@DlXNNHTcu4ECreate Order Timer in MS Excel using VBA @vEOXwnWMUTA

  • @wikimoc
    @wikimoc 9 років тому

    Thanks a lot Dinesh

  • @internationalstatisticianm3952
    @internationalstatisticianm3952 3 роки тому

    Thank you

  • @shaharle88
    @shaharle88 9 років тому

    Hi Dinesh
    Is it possible to make code that you can move between sheets with timer?

  • @edwin60590
    @edwin60590 11 років тому

    thanks alot for the algorithm

  • @mallemang
    @mallemang 11 років тому

    excellent job..thanks

  • @bhp3735
    @bhp3735 4 роки тому

    좋은 영상 감사합니다.

  • @salvatoretesta9825
    @salvatoretesta9825 4 роки тому

    Tnx great. :)

  • @MrAnupam111
    @MrAnupam111 8 років тому

    when I click or entered value in cell a1 timer auto start and when I complete my work and entered value in b1 timer auto end and show me the timing as how much time I consume in completing work in cell c1

  • @ejazahmedev
    @ejazahmedev 11 років тому

    Hi Gio,
    You have to call the Application.OnTime with Schedule:=False with the exact time you scheduled it to begin with.
    Hence it is a good idea to store the time you are scheduling a call to a public variable. And then use that variable to call the Application.Ontime procedure. That way, your StopUpdate procedure would work for sure.
    Let me know if that doesnt make sense.

  • @thecoolguy365
    @thecoolguy365 11 років тому

    How to have the timer count in clock format. example when timer reaches 60 it
    should show 1:00.
    Thanks

  • @powerluke7368
    @powerluke7368 9 років тому

    Thank You !!!!!!

  • @tihenry2k
    @tihenry2k 11 років тому

    Please how can I add millisecond to a timer using your codes?

  • @Testing_QualityAnalyst_Channel
    @Testing_QualityAnalyst_Channel 8 років тому

    Dinesh sir how can we set timer in Userform?

  • @edwin60590
    @edwin60590 11 років тому

    thank you so much....

  • @ZubairChoudhary
    @ZubairChoudhary 3 роки тому

    Great

  • @jay55patel
    @jay55patel 8 років тому

    thank you very nice

  • @xlNESxl
    @xlNESxl 8 років тому

    Hi. I was wondering if i can update a label or textbox within the userform rather than an excel cell? thank you

    • @Exceltrainingvideos
      @Exceltrainingvideos  8 років тому

      Check these links:
      www.exceltrainingvideos.com/tag/how-to-get-data-from-worksheet-into-combo-box-and-text-boxes-on-user-form/
      www.exceltrainingvideos.com/transfer-data-from-user-form-to-multiple-worksheets-in-excel-workbook-using-vba/

  • @reeteshism
    @reeteshism 4 роки тому

    Hello there. Not sure whether this is the correct platform to ask this question, however was not able to find the video about the question which I'm going to ask.
    I'm trying to create a tracker on excel using VBA, which captures the "START TIME" and "END TIME" of a specific task.
    The tracker is almost complete. The only thing where I'm getting stuck is on the message box command.
    Suppose, there are 2 buttons "START TIME" & "END TIME". If without clicking on the "START TIME" button someone clicks on "END TIME", they will get a message box which says "Task Not Started".
    However, if a task is already started and ongoing and instead of clicking on "END TIME" to stop the task, the person clicks on "START TIME" again, it starts a new task and the old one doesn't end.
    If you could help me with the VBA Coding where in I'll be able to get a message box which says "End Previous Task", if someone clicks on "START TIME' again instead of clicking on "END TIME" to stop the ongoing task. Or copy the url of the video if you already have discussed this on any of your videos
    Thanks

  • @fab99fab
    @fab99fab 8 років тому

    I have similar code for the timer start and stop but the problem is I am getting run time error 1004 stating method on time of object application failed. please help why m I getting this error ?

  • @learnshare
    @learnshare 11 років тому

    Thank's ;-)

  • @EleazarCrucesOchoa
    @EleazarCrucesOchoa 7 років тому

    Muy bueno, Very good.

  • @techvideos4281
    @techvideos4281 7 років тому

    Hi Dinesh,
    For Excel's cell u used code:
    Range("A3").Value=Range("A3")+1
    but what shoud I use for the textbox in the userform?
    Please Help

  • @Flyinghigher2011
    @Flyinghigher2011 11 років тому

    this is a count up timer i could really do with a COUNTDOWN timer please

  • @mcelearr
    @mcelearr 8 років тому

    Cheers buddy :)

  • @jannahashraf
    @jannahashraf 9 років тому

    Hi Mr.Dinesh,
    Hope you are fine,
    I want to ask about how to put a timer - Counter on the user-form in Excel VBA that i Made an Exam with multiple choice with 50 Questions on 50 Forms (Next By next) and want the exam is close Automatically when the time is finished, So can you help in this issue.

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      Ashraf Elsheikh This link might help: www.exceltrainingvideos.com/timer-in-excel-using-vba/

  • @MrAnupam111
    @MrAnupam111 8 років тому

    how to calculate auto timer calculation

  • @Sancarn
    @Sancarn 9 років тому

    Hello Dinesh,
    How would one go about having a 20Hz timer? As in a counter that increments every 1/20th of a second?
    I would guess it is something like Application.OnTime Now + TimeValue("00:00:00:05")? Or does the TimeValue only work down to seconds?

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      Sancarn Just try it out!

    • @Sancarn
      @Sancarn 9 років тому

      Dinesh Kumar Takyar Yeah it didn't work sadly :/ It just returned an error! xD

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      Sancarn Try this:
      Application.OnTime Now + TimeValue("00:00:001")
      and in the increment part: Range("A1").Value = Range("A1").Value + 0.1

    • @Sancarn
      @Sancarn 9 років тому

      Dinesh Kumar Takyar It may have been because I am really new and did it in a multi worksheet document actually... (And I may not have put it in a module! Oops! xD)
      I will try again later! :D I'm just using excel to make a game and wanted a 20 Hz clock to make checks and stuff :D But so far I'm just doing some terrain generation exercises! I never knew excel could be so much fun!

  • @Macman123ization
    @Macman123ization 11 років тому

    Application.OnTime Now + TimeValue("00:01:01"), "Increment_count", Schedul:=False
    - whats wrong??
    Thanks, btw :) !

  • @iankarremans9397
    @iankarremans9397 10 років тому

    how can I change the format of the timer cell so it will read hours/Minutes/seconds?

    • @Exceltrainingvideos
      @Exceltrainingvideos  9 років тому

      ian karremans You could use a code like so:
      Selection.NumberFormat = "h:mm:ss"
      ThisWorkbook.Sheets(1).Range("A1") = Time

  • @rajaprabhas455
    @rajaprabhas455 10 років тому

    Hi Dinesh, First wanna thank u for your video tutorials, they were very helpful for beginners like me. Dinesh, i need a help. i have a macro where i need to fill color in multiple cells in my excel using timer. i have the logic to fill the color and im using your macro code. its working fine, but as i am incrementing by second in the timer color updating is taking much time. i need to complete this in a few seconds so i need to use Milli Second in timer incrementing. as per your previous comments,
    i used Application.OnTime Now + TimeValue("00:00:01.001"), "INC"
    but its getting run time error-->type mismatch.
    Please kindly help me out on this issue. Thanks in advance :)

    • @Exceltrainingvideos
      @Exceltrainingvideos  10 років тому

      Where are you placing the code for color change?

    • @rajaprabhas455
      @rajaprabhas455 10 років тому

      Dinesh Kumar Takyar In place of Increment_count(), i have placed by function color_update.

  • @nishtha458
    @nishtha458 4 роки тому

    Userform me countdown timer kaise add kar sakte hai

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      The link to this VBA tutorial will guide: ua-cam.com/video/V-GiZ2PhXUE/v-deo.html

  • @Jay1637
    @Jay1637 11 років тому

    Is there a way to create a simple version of this in Excel without having to do all these ridiculous steps. Too much to do for such a small task. All I want to do is create a vacation countdown timer that includes the months, days, minutes and seconds.

  • @delcote6442
    @delcote6442 6 років тому

    Why does the timer stop each time a change worksheets?

    • @delcote6442
      @delcote6442 6 років тому

      It actually resets to 1, once I come back to the sheet

  • @sodisaperedinonsaper
    @sodisaperedinonsaper 11 років тому

    Yes...all the code works except the stop...
    Sub StopUpdate()
    Application.OnTime Now + TimeValue("00:00:01"), "Copy", Schedule:=False
    End Sub

  • @Abubakar-ki8ex
    @Abubakar-ki8ex 3 роки тому

    i want timer in excel vba

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      There must be at least 5 videos on this theme in this channel.

  • @MrAnupam111
    @MrAnupam111 8 років тому

    please advise

  • @Abubakar-ki8ex
    @Abubakar-ki8ex 3 роки тому

    reply plz

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому +1

      Replied.

    • @Abubakar-ki8ex
      @Abubakar-ki8ex 3 роки тому

      @@Exceltrainingvideos sir know i want
      if 2 cell value same ho
      then
      Stop Timer

    • @Abubakar-ki8ex
      @Abubakar-ki8ex 3 роки тому

      @@Exceltrainingvideos
      Your Some video helpful for me
      jasy increse number with timer in excel vba