H
hughg
Please could anyone tell me why the following formula doesn't work? I
am trying to find out if a name already exists in my worksheet. What
ever name is entered through a message box it remains perminently
false.
Function IsNameInWorkbook(stName As String) As Boolean
Dim X As String
Dim Rng As Range
Application.Volatile
On Error Resume Next
Set Rng = Application.Caller
Err.Clear
If Rng Is Nothing Then
X = ActiveWorkbook.Names(stName).Name
Else
X = Rng.Parent.Parent.Names(stName).Name
End If
If Err.Number = 0 Then IsNameInWorkbook = True
End Function
Many thanks for any help
am trying to find out if a name already exists in my worksheet. What
ever name is entered through a message box it remains perminently
false.
Function IsNameInWorkbook(stName As String) As Boolean
Dim X As String
Dim Rng As Range
Application.Volatile
On Error Resume Next
Set Rng = Application.Caller
Err.Clear
If Rng Is Nothing Then
X = ActiveWorkbook.Names(stName).Name
Else
X = Rng.Parent.Parent.Names(stName).Name
End If
If Err.Number = 0 Then IsNameInWorkbook = True
End Function
Many thanks for any help