Runtime 424 updating collection
Example: Below is a self-explanatory example of ‘On Error Goto In this code as soon as the exception occurs at Line 3, the program transfers the control to the Line 6.
Notice that here I have used ‘Exit Sub’ just before the ‘Error_handler:’ label, this is done to ensure that the Error handler block of code doesn’t execute if there is no error.
Fortunately, there's a quick and simple way to reset the used range when necessary.
As with many aspects in Excel, the used range is fraught with nuance, but you can easily set up an example to understand the concept.
This method is more suitable for exiting the program gracefully if any fatal error occurs during the execution.
This is the third form in which VBA On Error statement can be used.
This statement tells the VBA to transfer the program control to the line followed by the label, in case any runtime errors are encountered.
As illustrated in Figure 1, carry out these steps in a blank worksheet: To access all of the content on our site, register (it's free! BONUS: If you register now you can opt to receive a digital copy of "Transform!
" , Richard Francis' new book for growing firms [US/Canada ONLY].