Schedules to Refresh Data Automatically using VBA Macro

I once asked by Joshuacht about how to make a macro running every 15 minutes. Let say because every 15 minutes we have to refresh or reload the data in the Workbook.

Below is a sample of how we can do this in Microsoft Excel *just an outline*.

The logic is simple, when we open the Workbook, we call for the first time the procedure needed to refresh the data. In that procedure, we also add a code to call back the procedure itself 15 minutes later. So while the Workbook is still open, the procedure will continue to call itself every 15 minutes.

' Put this procedure in ThisWorkbook module
Private Sub Workbook_Open()

    ' Run the procedure to refresh data when the workbook opened
    Call RefreshData

End Sub

' Add new module and put this procedure in it
Public Sub RefreshData()

    Debug.Print "Data refreshed at " & Now
    '
    ' This is where we put everything needed to refresh the data
    '

    ' Schedules this procedure to be run 15 minutes from now
    Application.OnTime Now + TimeValue("00:15:00"), "RefreshData"

End Sub

Even looks like an infinite loop, this is not a problem for Excel when we use Application.OnTime function. The scheduling will stop automatically when the Workbook is close.

This entry was posted in Workbook and Worksheet and tagged , , , , , , . Bookmark the permalink.

599 Responses to Schedules to Refresh Data Automatically using VBA Macro

  1. hwsris says:

    Thanks you Poer.

  2. Poer says:

    with pleasure :D

  3. Pingback: UNCF Scholarships

  4. Pingback: Tummy Tuck

  5. Pingback: Tummy Tuck Pictures

  6. Pingback: home mortgage calculator

  7. Pingback: debt consolidation companies

  8. Pingback: reverse mortgage calculator

  9. Pingback: acid reflux symptoms

  10. Pingback: dating factory bonus

  11. Pingback: debt collection rate

  12. Pingback: collection agency rates

  13. Pingback: debt collection agency

  14. Pingback: collection agency newsletter

  15. Pingback: lose 10 pounds in a week

  16. Pingback: credit report for free

  17. Pingback: free fico score

  18. Pingback: Imagenes de Amor

  19. Pingback: wedding photographer calgary

  20. Pingback: Peluang Usaha

  21. Pingback: iphone 4s unlucked

  22. Pingback: ??????????? ???????

  23. Pingback: What is the iPhone 5 Price?

  24. Pingback: Party Supplies UK

  25. Pingback: flirttipps

  26. Pingback: Erotiek Groothandel

  27. Pingback: target online coupon codes

  28. Pingback: Sign Maker

  29. Pingback: hsbc credit card payment

  30. Pingback: pret auto

  31. Pingback: prets personnels

  32. Pingback: web design

  33. Pingback: scientific forex

  34. Pingback: 3 bureau credit report

  35. Pingback: gun shops

  36. Pingback: hobby lobby

  37. Pingback: SEO Services

  38. Pingback: home depot coupons

  39. Pingback: Foreign Exchange Clothing

  40. Pingback: chota bheem games

  41. Pingback: overstock promo code

  42. Pingback: walmart coupons

  43. Pingback: Aeropostale coupons

  44. Pingback: amazon coupon code

  45. Pingback: search for jobs

  46. Pingback: Amazon promotional code

  47. Pingback: how to check your free credit report

  48. Pingback: amazon coupon code

  49. Pingback: wine types

  50. Pingback: Bed Bath And Beyond Coupon

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>