excel - '28' Out of Stack Space. Worksheet_Change and Application.ScreenUpdating -


Whatever clarifications you can provide, thanks in advance.

In an Excel workbook with several modules and worksheets, this substrate is at the bottom of the VBA code for SHEET2:

  Personal sub worksheet tags (range form) In-target) Set the target as a slow target TargetCells = Range ("B1000: B1029") If not, then the application.Interacte (targetcale, range (target address)) is nothing, then make specific call, end the shoobineline Is the end   

My understanding of this code is that it is Looks at the entire sheet to change. If anything has been changed, anywhere on the sheet, then this statement I if the statement fails in the event, then any of the changes made in the sheet are out of the specified code TargetCells But if this sub still makes statements, then every time anything goes on the sheet.

Now, you can guess that my problem is some stack overflow (run-time error '28': out of stack space)

whenever worksheet tags < / code> sub runs, if the change in Sheet calls in the TargetCells range, it calls the typical childreutin , which populates cells, which is worksheet tags < / Code> runs each cell of specific web browser each time. ( SpecificSubutyin also calls different modules, which certainly populate cells, which surely trigger Worksheet_Change sub)

Not very good.

In addition, most subtitles in the whole application are wrapped in Application.ScreenUpdating = False / Application.ScreenUpdating = True , which I accidentally The number of thought that will be limited will be once the worksheet tag is called once, immediately after the application. Screen Update = True runs.

Note of importance: Neither specific shubratinin nor any sub-route is called by TargetCells < / Cells> populate cells in the category. I'm not quite slow ...

These are my questions:

  1. Is the scope of triggering worksheet tags Is there a way to reduce, so that the TargetCells range triggers it? (Instead of a change anywhere in the sheet)
  2. Is there a way to do that I accidentally thought that Application.ScreenUpdating would do?
  3. In addition, as an additional curiosity, Worksheet_Change Code> to view 2 specific categories (instead of the entire sheet) to know how to do it, it would be paramount, and possibly solve all the problems on this sheet.

    Adding my intuition is ending to for the last part, specific shurayetin , or any / all subroutines it has been called by Finally, but I still do not know that it will leave looping behind many times via Worksheet_Change , because Application.ScreenUpdating bulk updates like I did not think .

    Thoughts? Part 1: No - Event Handler Answers All Changes On Sheet: In any filtering you can: How to respond to that change Handler himself

    Part 2: Answer by @Symoko

    Part 3 (And Reduce Suggestion of Simcoo Incorporated):

      Private Sub Worksheet Tags ( Range by-target) application. Enable Enable Events = False If Not Application.Intersect (Me.Range ("B1000: B1029", Goal) is nothing, then call the specific Sbartin termination if not else the application. The difference (Me.Range ("D1000: D1029", target) is nothing if you call some other specific shabreutin and if the application. EnableEvents = True End Sub    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -