+ Reply to Thread
Results 1 to 6 of 6

Allow run macro only within current month

  1. #1
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Allow run macro only within current month

    Hi people,

    I was wonder if there is a code that prohibit the use of the macro out of the period declared. For example I want that users can run the macro only in November from 1rst - 30th. If they want to use the macro in December, they would need to come to me so I can change the code for a new period and so forth.

    I appreciate it.

    Thanks,

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,986

    Re: Allow run macro only within current month

    .
    Please Login or Register  to view this content.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Allow run macro only within current month

    How do you specify what the "period declared" is? In the code? Here is an example that will allow the code to run only in November:

    Please Login or Register  to view this content.
    HOWEVER, the fact that you said that you have to update code for a new period suggests that you have a design problem. Your code should be written to be valid for whatever period your data indicates.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Allow run macro only within current month

    Thank you Logit, this worked great!

  5. #5
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Allow run macro only within current month

    Thank you, I can certainly have design problems. I am new on this, thank you for letting me know this, otherwise I would keep doing the same. btw your code worked great too.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,986

    Re: Allow run macro only within current month

    .
    You are welcome.

+ 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. Replies: 1
    Last Post: 04-29-2016, 01:28 PM
  2. Macro for Previous and Current Month
    By angeleenmc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2015, 12:56 PM
  3. [SOLVED] Macro to cut and paste current month sheet into the relevant month chosen by a drop down
    By scotty22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-06-2015, 09:07 AM
  4. [SOLVED] Set PivotTable Filter to Current Day, Current Week, Current Month, or Current Year
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2014, 08:31 AM
  5. [SOLVED] Pick a cell containing current month actulas based what the current month is.
    By vanbasten007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-10-2014, 01:17 AM
  6. [SOLVED] Macro to find current month in row
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 03:02 PM
  7. Macro using vlookups comparing 2 months paysheet(previous month and current month)
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-07-2012, 03:45 AM

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