Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

Display cell address and message box on error and exit the Macro, if not, continue

$
0
0

I want to first check my Range for #NA errors and then display the cell addresses containing the error before quitting the Macro. This is what I've done so far.

Now, if there are errors present, I'd like to display a MsgBox warning the user of the error and stop the rest of the program from executing, if however there are none then I'd like for it to move on to the rest of the program

Check for NA error:

For Each c In myRange

    If IsError(c) = True Then

        Debug.Print c.Address

    End If

Next c

MsgBox "Check for errors and run gain"

Exit Sub

'continuation of the program

Viewing all articles
Browse latest Browse all 88835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>