Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Can we able to automate to run two different macros at different interval

0

Hi,

Can we automate to run two different macros at different interval.

means one macro to run at one time followed by another macro at respective intervals.

Thanks,

Nitil 

Answer
Discuss

Answers

0
Selected Answer

Nitil

Firstly, you should read Don's tutorial Run a Macro at Set Intervals in Excel

In the attached file, i've taken the file from that tutorial and copied (/tweaked) the three macros (now macro2 etc.) and placed two more buttons on the sheet, assigning the new macros to them as appropriate.

Click the grey "Start" button, and you'll get a message every 5 seconds. Click the pink "Start 2" button and you'll get another message every 13 seconds.

These are running in parallel. Press a Stop button (and wait a bit) for either to cease.

To use them practically, you need to adjust the timings and replace the MsgBox with whatever you want to do.

REVISION 1: attached amended file (since original called wrong timer for second macro).

Hope this helps.

Discuss

Discussion

Thanks John for your solution
NitilA (rep: 14) Feb 11, '21 at 2:55 am
Nitial. No problem but under the rules of the Forum, if it answered your question, you need to mark my Answer as Selected. Thanks in advance. 
John_Ru (rep: 6142) Feb 11, '21 at 3:16 am
Just realised that my second macro called the first timer for repeats (not the second) in error. Have attached revised file which corrects that).
John_Ru (rep: 6142) Feb 11, '21 at 4:02 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login