excel 2010 VBA throws “can't execute code in break mode” while stepping

后端 未结 1 957
一整个雨季
一整个雨季 2020-12-20 09:23

I have just moved to excel 2010, have discovered surprising behaviour when stepping through code. When stepping through code it often throws the error Can\'t execute

相关标签:
1条回答
  • 2020-12-20 09:30

    While this may not exactly answer the Can't execute... error, can you please try if the following code throws the same error? I believe that the Select usage in your code is causing this as I've experienced much the same in the past...

    Sub nmMod()
        Set Start = Sheets("Winput").Range("A10")
        EndCol = Start.End(xlToRight).Column
        EndRow = Start.End(xlDown).Row
        Start.Resize(EndRow, EndCol).Copy
        Sheet2.Range("A1").PasteSpecial xlPasteAll 'mock action, change as necessary
    End Sub
    

    It is best to avoid any kind of selection as much as possible. Emulating a Select action is much slower and gives rise to other issues (ie. They can cancel a standing copy, mess up actions especially involving shapes, etc). It will not be much of a surprise if this is the one causing the error itself.

    0 讨论(0)
提交回复
热议问题