I have a Macro called WeatherData which I would like to have run everyday automatically at 7:00am in the morning. If the workbook is left open, does anyone know how to easily automate this process?
paste this macro into the module with YOUR macro.
here I set the time in cell B2. (change if you need)
run : RunTimerApp
it will load and run your macro (here its: mMyMacro ) at the given time.
Code:
Public Sub RunTimerApp()
Dim vTim
vTim = Format(Range("b2").Value, "hh:nn:ss")
Application.OnTime TimeValue(vTim), "mMyMacro"
End Sub
I put the code in the Module in the top line. Where is cell b2 and do I put a time in the cell? (i.e., 07:00:00) Below is the slightly updated code where I changed "mMyMacro" to "WeatherData" Is this correct?
Public Sub RunTimerApp()
Dim vTim
vTim = Format(Range("b2").Value, "hh:nn:ss")
Application.OnTime TimeValue(vTim), "WeatherData"
End Sub
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.