How to stop VBA code running?

后端 未结 7 778
臣服心动
臣服心动 2020-12-08 11:22

Say I have a button embedded into my spreadsheet that launches some VBA function.

Private Sub CommandButton1_Click()
    SomeVBASub
End Sub

Private Sub Some         


        
相关标签:
7条回答
  • 2020-12-08 12:23

    I do this a lot. A lot. :-)

    I have got used to using "DoEvents" more often, but still tend to set things running without really double checking a sure stop method.

    Then, today, having done it again, I thought, "Well just wait for the end in 3 hours", and started paddling around in the ribbon. Earlier, I had noticed in the "View" section of the Ribbon a "Macros" pull down, and thought I have a look to see if I could see my interminable Macro running....

    I now realise you can also get this up using Alt-F8.

    Then I thought, well what if I "Step into" a different Macro, would that rescue me? It did :-) It also works if you step into your running Macro (but you still lose where you're upto), unless you are a very lazy programmer like me and declare lots of "Global" variables, in which case the Global data is retained :-)

    K

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