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. Pingback: rayban sunglasses

  2. Pingback: iphone 2g unlocked

  3. Pingback: financing car information

  4. Pingback: Vampire Games Online

  5. Pingback: mujeres

  6. Pingback: how to tie a tie for dummies

  7. Pingback: Paralegal

  8. Pingback: painting brisbane

  9. Pingback: in english

  10. Pingback: ipod touch 5g

  11. Pingback: web address

  12. Pingback: seo nashville

  13. Pingback: walk in freezer on-line

  14. Pingback: Accent Table

  15. Pingback: bankruptcies

  16. Pingback: How to grow taller

  17. Pingback: visit our site

  18. Pingback: official website

  19. Pingback: passive residual income

  20. Pingback: Consol

  21. Pingback: Best Place To Sell Gold

  22. Pingback: bad credit military loans

  23. Pingback: wisdom teeth extraction

  24. Pingback: Carpet Cleaning Boston ma

  25. Pingback: apex merchant group careers

  26. Pingback: Cod Liver Oil

  27. Pingback: copyright

  28. Pingback: found it

  29. Pingback: /bowmel-chrysler-dunc/bowmel-chrysler-du

  30. Pingback: bad credit mobile phones

  31. Pingback: Home Depot Patio Furniture

  32. Pingback: cakes

  33. Pingback: mexican food at home

  34. Pingback: Creation Site Internet Annecy

  35. Pingback: va loan after short sale

  36. Pingback: xc skis

  37. Pingback: vitamins

  38. Pingback: Software

  39. Pingback: make your own beats

  40. Pingback: jobs to do from home

  41. Pingback: make up coupons

  42. Pingback: url

  43. Pingback: paycheck loans

  44. Pingback: website

  45. Pingback: address

  46. Pingback: cash loans online website

  47. Pingback: diabetic bags

  48. Pingback: buy motivational speaker brisbane

  49. Pingback: apex merchant review

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>