+ Reply to Thread
Results 1 to 3 of 3

Issue with combining two separate Worksheet_Change macros...

  1. #1
    Registered User
    Join Date
    07-03-2015
    Location
    Cincinnati
    MS-Off Ver
    365
    Posts
    4

    Issue with combining two separate Worksheet_Change macros...

    I am having some problems with the coding posted below. I had my friend who actually has a degree in some sort of coding something or another (took lots of VBA and C++ classes etc etc) and does it for a living, and he couldn't figure out the issue either... I am hoping to not need to go through the process of creating a mock file (one I am using this on has sensitive data on it) but if I need to, I will.

    Please Login or Register  to view this content.
    I am fairly new to VBA (a few weeks total under my belt); lots of googling and copy/pasting to get a foundation of what I need, then tweak from there. Hopefully I got everything here that I need to get some help. I have messed with it for a while now and I am absolutely stumped.
    Working in Excel 2013.

    I will also note, these two sections work PERFECT separately, but when combined, switching between the two actions on the spreadsheet breaks the entire code. There are no errors saying the code broke, but it just stops working.
    Last edited by evlsnk; 09-29-2015 at 10:33 AM. Reason: Solved!

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

    Re: Issue with combining two separate Worksheet_Change macros...

    In the bottom section, you use Application.EnableEvents = False, but do not turn it back on after clearing the cells. That means the procedure will trigger one time and turn off events. It will not trigger a second time until you re-enable events.

    Add this after each .ClearContents
    Please Login or Register  to view this content.
    Or just put it as the last line of the procedure. You always want to end an event procedure with events enabled.
    Last edited by AlphaFrog; 09-29-2015 at 03:14 AM.
    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.

  3. #3
    Registered User
    Join Date
    07-03-2015
    Location
    Cincinnati
    MS-Off Ver
    365
    Posts
    4

    Re: Issue with combining two separate Worksheet_Change macros...

    This was the first part of my solution, so thank you for cluing me in to that. The final part was to remove the "Exit Sub" lines up top:
    Please Login or Register  to view this content.
    After removing these, it worked perfectly. Thanks for the help Alpha!

+ 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] Help with combining two worksheet_change macros
    By goatie43 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-27-2015, 09:07 PM
  2. Combining a Sub Worksheet_Change and S W_Calculate
    By peasther in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2015, 01:11 AM
  3. Combining two Worksheet_Change
    By Intern2 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-11-2013, 10:47 AM
  4. Combining two Worksheet_Change Events
    By Fett2oo5 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-09-2013, 01:05 PM
  5. [SOLVED] Combining 2 different Worksheet_Change
    By dacos in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2012, 08:28 PM
  6. Combining two Private Sub Worksheet_Change
    By bdf0827 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-14-2011, 08:58 AM
  7. Combining Two Worksheet_Change Entries
    By alex1982 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2007, 07:57 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