VBA: How long does On Error Resume Next work?

前端 未结 4 1138
日久生厌
日久生厌 2020-11-28 15:55

I\'m reading up on how to use On Error Resume Next and I\'m trying to figure out how long that line will apply to the program. On the Microsoft site, I found t

4条回答
  •  半阙折子戏
    2020-11-28 16:44

    You don't always need a bunch of code to handle an error, but you really should do something with it. Maybe just have your code change the cells.font.color property to vbRed. Simply doing On Error Resume Next (a line of code that might error) On Error Goto 0 is terribly poor form.

    And like others have pointed out, On Error Goto Label is essentially VBA's version of Try ... Catch, and I use it frequently

提交回复
热议问题