Excel - Running Macro Automatically

December 2016


Issue

You have a macro in excel that needs to be run twice a day and you don't even want to open the Excel sheet. How can you make this process automatic?

Solution

Add the macro code to Excel open event. You can create an excel file and make it run twice a day
by creating a new task and by adding its path to "Scheduled Tasks" within double quotes under:
Start>Programs>Accessories>System Tools
  • <souligne>In the VB window > 'Thisworkbook' page select workbook then add the following coDes:


Private Sub Workbook_Open()  
' add code here
End Sub


workbooks("Workbookname").save

workbooks("Workbookname").close


As for the time:

If Hour(Time) = "24" then 


Thanks to Excelguru for this tip on the forum.

Related :

This document entitled « Excel - Running Macro Automatically » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.