currently, I need to press a button at 09:10:05 every day to run the attached (photo shared) module in VBA after the code runs automatically in five minutes, Is there any way possible I can automate that at 9:10:05 the module runs automatically?
where should I place this code? earlier I tried to place after end if but it's not workingApplication.OnTime TimeValue("09:10:05"), "Algomojo"
sir, it's a different thing other codes ( in worksheets ) working automatically but for modules, I need to press the button to startHere is one way:
![]()
How To Automatically Run Excel VBA Macros Daily
Learn how to utilize a few programs you already have to create automation rules that will automatically open up your Excel files, run VBA code, save the changes, and then close the file. These automations can even be setup to run while you sleep!www.thespreadsheetguru.com
The potential problem with using Application.OnTime is that the workbook needs to be open at that particular time on a computer.sir, it's a different thing other codes ( in worksheets ) working automatically but for modules, I need to press the button to start
@Dipak543, if using WTS isn't an option for you, you might take a look at this thread for an example on how to implement an OnTime scheduled macro; the OP's issue is different, implementation details are similar:where should I place this code? earlier I tried to place after end if but it's not working
yes sir my excel automatically open at 9 am but the module is not running still i need to press the start button to run the code.The potential problem with using Application.OnTime is that the workbook needs to be open at that particular time on a computer.
If you know that will always be true, then go ahead and use that method.
However, in most of my experiences, that is not always true, as we usually want to run jobs overnight or on days in which the computer may not be on.
In those cases, it works better to run the job from a Scheduler on a Server which is always turned on (then it is not dependent on a computer being on and the file being open). So my option deals with that situation.
Use whatever is better for you.