Forum Discussion
LemonPeeler
Aug 25, 2022Copper Contributor
How do we exit a CASE SELECT block?
How do we exit an Excel SELECT CASE block? We have found a Microsoft Docs indicating that you can only use the EXIT SELECT command if it is between the SELECT (or SELECT CASE) and the matching END SE...
LemonPeeler
Aug 25, 2022Copper Contributor
Hello Joe, one other question if we may. Can we include a RESUME NEXT in a SELECT CASE routine to exit the select case, without processing subsequent commands, and then process the next item in a FOR loop?
JoeUser2004
Aug 25, 2022Bronze Contributor
LemonPeeler wrote: ``Can we include a RESUME NEXT in a SELECT CASE routine to exit the select case``
No. From the VBA help page for the Resume statement: ``Resumes execution after an error-handling routine is finished.`` To learn more about error-handling (albeit not relevant to your questions), see the VBA help page for the On Error statement.
For VBA help pages, I select offline help, not online help. Then I enter a keyword into the search window to the right of Help on the VBA toolbar.
-----
LemonPeeler wrote: ``[...] and then process the next item in a FOR loop?``
No. And there is no Continue statement in VBA.
Use GoTo for both purposes.
- LemonPeelerAug 25, 2022Copper ContributorThank you so much!