Function test4Name(target As Range) As Boolean
Dim n As Name, fullRef$
fullRef = "='" & target.Parent.Name & "'!" & target.Address
For Each n In ActiveWorkbook.Names
If n = fullRef Then
test4Name = True
Exit Function
End If
Next n
End Function
Function test4Name(target As Range) As Boolean
'Test if target is a Named Range.
Dim n As Name, fullRef$, quote$
With target
quote = IIf(UBound(Split(.Parent.Name)), "'", "")
fullRef = "=" & quote & .Parent.Name & quote & "!" & .Address
End With
For Each n In ActiveWorkbook.Names
If n = fullRef Then
test4Name = True
Exit Function
End If
Next n
End Function
Function test4Name(Target As Range) As Boolean
On Error Resume Next
test4Name = ObjPtr(Target.Name)
End Function
I know I've done this before but can not for the life of me remeber the syntax I used. Writing an If statement and need to first determine if the target cell is a named range.
If Target.HasName kinda thing.
Any suggestions?
<CODE>Worksheets("Sheet1").ActivateSet isect = Application.Intersect(Range("rg1"), Range("rg2"))If isect Is Nothing Then MsgBox "Ranges do not intersect"Else isect.SelectEnd If</CODE></PRE>
<CODE>