Error Handling > basic technique > further to carry on
Option Explicit
Sub EnterSquareRoot()
Dim Num As Variant
If TypeName(Selection) <> "Range" Then
MsgBox "Select a cell for the result."
Exit Sub
End If
Num = InputBox("Enter a value")
If Not IsNumeric(Num) Then
MsgBox ("You must enter a number.")
Exit Sub
End If
If Num < 0 Then
MsgBox ("You must enter a positive number.")
Exit Sub
End If
ActiveCell.Value = Sqr(Num)
End Sub