using the On Error Resume Next statement : Resume « Language Basics « VBA / Excel / Access / Word






using the On Error Resume Next statement

 
Sub SelectionSqrt()
    Dim cell As range
    If TypeName(Selection) <> "Range" Then Exit Sub
    On Error Resume Next
    For Each cell In Selection
        cell.value = Sqr(cell.value)
    Next cell
End Sub

 








Related examples in the same category

1.Uses a Resume statement after an error occurs:
2.Check the error number with Select Case statement