Sub CheckType() If TypeName(Selection) <> "Range" Then MsgBox ("select a range") Exit Sub End If End Sub