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
-
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)
- 热议问题