And there are actually some problems when the selection is a single cell. The
..specialcells stuff will look at the entire sheet.
Your code could be a little more robust:
Option Explicit
Sub testme01()
Dim myRng As Range
Set myRng = Nothing
On Error Resume Next 'in case there are no errors
Set myRng = Intersect(Selection, _
Selection.SpecialCells(xlCellTypeFormulas, xlErrors))
On Error GoTo 0
If myRng Is Nothing Then
MsgBox "No Errors in Selection"
Else
myRng.Select
End If
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.