+ Reply to Thread
Results 1 to 11 of 11

After running this macro a dynamic range stops working. How to fix?

  1. #1
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    After running this macro a dynamic range stops working. How to fix?

    Hi. Any guess on why this macro is blocking the worksheet selectionchange macros after been triggered?

    Thank you


    Please Login or Register  to view this content.
    Last edited by 80Wil; 04-29-2017 at 09:50 AM.

  2. #2
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro selectionchange macros stop working. How to fix?

    Also those macros are blocking the selectionchange when triggered
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by 80Wil; 04-29-2017 at 08:39 AM.

  3. #3
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro selectionchange macros stop working. How to fix?

    Yep, maybe something to do with the loop. Cause Previous and Next call a macro who has a loop itself...

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro selectionchange macros stop working. How to fix?

    In the other hand this macro that also calls BuscarCodigo (just like previous and next above) that has a loop when triggered doesnt mess up with the selection change...

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro selectionchange macros stop working. How to fix?

    Sorry... thinking better the selection change is not being affected... but the dynamic range... that should acts after the selection change

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,208

    Re: After running this macro a dynamic range stops working. How to fix?

    Suggest you post a sample workbook with some typical data and all your code.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro a dynamic range stops working. How to fix?

    Yep! I'm finishing it... will post in a couple of minutes

  8. #8
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro a dynamic range stops working. How to fix?

    So... I've reproduced what is happening in this attached file.
    I have no clue.
    I know if I change the position of the enable events to true right AFTER End If... the problem doesn't occur but the macro takes too long to perform. So that's not the solution.

    ps Sheet2 has a macro inside.
    PS Also if you push SAVE NEW RECORD will cause the bug mentioned in the sample...

    Thank you
    Attached Files Attached Files
    Last edited by 80Wil; 04-29-2017 at 12:02 PM.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,208

    Re: After running this macro a dynamic range stops working. How to fix?

    One minor issue:

    Please Login or Register  to view this content.
    The code highlighted in red is, effectively, a cell selection change ... which will fire the Worksheet_SelectionChange. The code shown in blue demonstrates the impact of that selection change.

    Please Login or Register  to view this content.

    However, the real issue, AFAICS is this:

    Please Login or Register  to view this content.
    Here, the code in red exits the subroutine without executing the code highlighted in blue.

    Change the code to this:

    Please Login or Register  to view this content.
    Last edited by TMS; 04-30-2017 at 07:53 PM. Reason: Change highlighted text colour

  10. #10
    Forum Contributor
    Join Date
    11-02-2016
    Location
    brasil
    MS-Off Ver
    office 365 2016 windows
    Posts
    195

    Re: After running this macro a dynamic range stops working. How to fix?

    Beautiful! Thank you!

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,208

    Re: After running this macro a dynamic range stops working. How to fix?

    You're welcome. Thanks for the rep.

+ 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. Help!! Why would all of my macros stop working?
    By RichardJSigKits in forum Excel General
    Replies: 8
    Last Post: 12-17-2014, 09:10 AM
  3. [SOLVED] Macros stop working, supposed to find next empty cell in column and label...
    By Axil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2012, 01:11 PM
  4. Replies: 19
    Last Post: 05-31-2011, 09:00 AM
  5. Macros with parameters stop working
    By neta in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-09-2009, 07:39 AM
  6. 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
  7. 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

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