+ Reply to Thread
Results 1 to 4 of 4

Problem w Code to switch month and year

  1. #1
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Problem w Code to switch month and year

    I'm trying to help Gunther with this post
    http://www.excelforum.com/excel-gene...g-as-such.html

    but my code loops around a second time giving an error. How do I prevent this?
    Please Login or Register  to view this content.
    So it correctly adjusts the cell then gives an error because it tries to do it to the next cell (I believe). Thanks in advance.
    Last edited by ChemistB; 03-09-2011 at 04:31 PM.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  2. #2
    Registered User
    Join Date
    04-14-2010
    Location
    NZ
    MS-Off Ver
    2007,2010
    Posts
    86

    Re: Problem w Code to switch month and year

    to the beginning of that sub add - Application.enableevents = false

    and then to the end of it add - Application.enableevents = true

    That'll stop the Worksheet_Change event from running a second time when you make the change

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,620

    Re: Problem w Code to switch month and year

    Did you try turning EnableEvents off at the start of the macro and back on at the end?
    Ben Van Johnson

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Problem w Code to switch month and year

    The mistakes of a beginner. Thanks !

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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