+ Reply to Thread
Results 1 to 10 of 10

Have Autorun Macros but can we stop them running at one particular interval

  1. #1
    Registered User
    Join Date
    10-03-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Have Autorun Macros but can we stop them running at one particular interval

    Hello Everyone,

    I have two AUTORUN macro's ... one runs every 15 secs and one run every 15 mins. These two are running (auto running) without any conflict and I'm happy but I have a specific need --------- I want these two NOT to run at one particular interval (every Friday from 8:55 AM to 10:15 AM). I have managers meeting during this time and I don't want this sheet get updated (as this will be projected on a big monitor).

    Below goes the two autorun macro's ----- can someone please modify such that these two not during that one interval ---- I would really appreciate if someone can dig it. Thanks a lot in advance!!

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Have Autorun Macros but can we stop them running at one particular interval

    If the fact that the application ontime is still active, you could add an IF statement that checks if the VT value is a Friday and the VT time falls between 8:55 AM and 10:15 AM
    You'll have to play around with that, it's just an idea that popped up
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Have Autorun Macros but can we stop them running at one particular interval

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    10-03-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Have Autorun Macros but can we stop them running at one particular interval

    Thank you very much!!! this helps me a lot!!

    Making this to resolved!!

  5. #5
    Registered User
    Join Date
    10-03-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Have Autorun Macros but can we stop them running at one particular interval

    Hi There,

    I'm reopening this thread not because of my original questions which I posted earlier (those 2 things have been resolved) but I have new ask and this one is on the similar lines as my earlier. Also, this could be a simple one and that's the reason I don't want to open up a new thread. Hope I'm not violating any procedures here

    Ask:
    I wanted a macro to autorun on a particular day and at particular time ---- Every Friday at 8:47 AM. Below is the codes (1) and (2) I have written based on the similar on what was given to me earlier. Not sure what is wrong but this is not working. Can you please look into it and correct this. Thanks in advance!!

    Code-1
    Please Login or Register  to view this content.
    Code 2
    Please Login or Register  to view this content.
    Last edited by NametobeRenamed; 11-01-2019 at 04:36 PM.

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Have Autorun Macros but can we stop them running at one particular interval

    If you want it to run on a friday at a specific time, just set that in a variable and set the application ontime to that date and time and forget about checking if then else.

    The If then else was good for your first question because you wanted it NOT to run between two values.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Have Autorun Macros but can we stop them running at one particular interval

    What's in Workbook_Open ???
    What's the name of the macro you want to run on friday morning?

    My idea:

    Place the code below in a Module
    The Red line of code is the topmost outside the subs

    Please Login or Register  to view this content.
    In the Workbook_Open event

    Please Login or Register  to view this content.
    So every time the workbook is opened the macro is set to run on a friday at 8 47 AM

    I also suggest you place this in the

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Have Autorun Macros but can we stop them running at one particular interval

    Another way to calc the next Friday

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Have Autorun Macros but can we stop them running at one particular interval

    @AlphaFrog: true,much simpler,

  10. #10
    Registered User
    Join Date
    10-03-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    98

    Re: Have Autorun Macros but can we stop them running at one particular interval

    Thank you very much Keeballah and AlphaFrog!!

    You both helped me a lot ... once again thank you!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Event Driven Macros stop running after running a routine macro
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 12:34 PM
  2. Autorun macros
    By Graebeard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2010, 12:03 AM
  3. Web queries, Macros, Stop auto-running, Userforms
    By Flashart in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2008, 03:51 PM
  4. [SOLVED] Autorun macros on opening
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2006, 02:11 PM
  5. [SOLVED] How do I prevent AutoRun Macros when Programmatically Opening Workbook?
    By Joseph Geretz in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 03-26-2006, 06:30 PM
  6. Stop Macros from Running When Workbook Opened via Automation
    By Google Boy of Company C in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2005, 12:05 PM
  7. [SOLVED] AutoRun Excel Macros
    By JD in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2005, 05:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1