PDA

View Full Version : Delete Row sends Excel into an infinite loop



vodkasoda
06-25-2011, 02:39 AM
I've written a small application for my nephew that checks if a Cell in a certain Range is amended, then the sheet is updated by taking all of the data in that Range & replicating it below, but sorted into Column D order.

The attached is a very small example of this and I am happy with how it works ... HOWEVER ... if I delete a line, although the program seems to step through perfectly OK, Excel then goes into some kind of loop, it certainly isn't responding, I have to use Task Manager to end the Excel process !!!

I can obviously look into the "Insert" option myself when I understand why this is happening, as "Insert" will need a small routine of its own anyway ...

Can anybody help & explain what is going on and why :help ?!?!?

vodkasoda
06-25-2011, 03:43 AM
OK , missed the blatantly obvious ... as soon as I delete a Row, then this becomes the first blank Row and therefore the Range is wrong ... quite what happens to cause the looping I'm not sure, but this is obviously a contributory factor !!!

So ... as soon as the Delete key is pressed, the Event-Handler routine is triggered ... is there a way of trapping the fact that the Delete key has been pressed to delete an entire Row so that I can handle that manually ?