+ Reply to Thread
Results 1 to 3 of 3

Stop Worksheet change event from interfering with macro code

  1. #1
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Stop Worksheet change event from interfering with macro code

    Hi everyone,

    I have a worksheet event that seems to be interfering with the functionality of a macro.

    The macro is used for adding a specific number of new records based on the number value of a cell on the worksheet. Without the worksheet event code in place, the add record macro functions flawlessly. With it, no matter how many records are selected to be created, only one is created.

    The worksheet even watches a specific cell on each row and locks and unlocks cells in the same row when the value of the watched cell changes based on 5 different possible settings. Other than it interefering with the macro functionality, it too works flawlessly otherwise.

    I've been trying everything I can think of but I can't get the two to play nice together. The worksheet event code and the macro code are below. Can anyone tell me why this is happening and what I can do to fix it?

    Thanks, very much!

    Worksheet Event Code
    Please Login or Register  to view this content.

    Macro Code
    Please Login or Register  to view this content.
    -------------
    Tony

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Stop Worksheet change event from interfering with macro code

    Much as you do with ScreenUpdating, try setting the Application.EnableEvents property to False. This will stop changes made by code from firing other events - for example, the Worksheet_Change event.

  3. #3
    Forum Contributor BeachRock's Avatar
    Join Date
    11-01-2011
    Location
    Oregon, United States
    MS-Off Ver
    Excel 2016
    Posts
    403

    Re: Stop Worksheet change event from interfering with macro code

    Cytop, thanks very much! That did the trick. Still learning so didn't know about the Application.EnableEvents property. Great tip!

    It works beautifully now.

+ 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. Code for Worksheet Change Event Needed
    By ARGK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2013, 11:54 PM
  2. [SOLVED] Using Worksheet Deactivate event to run macro and stop deactivation if required
    By Bonnister in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2013, 11:00 AM
  3. Worksheet Change Event code help
    By kev_33 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-12-2013, 01:51 AM
  4. Stop code from triggering worksheet event
    By mashley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2010, 11:47 AM
  5. Replies: 5
    Last Post: 06-23-2005, 06:05 PM

Tags for this Thread

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