Hello Everyone,
I'm tearing my hair out. I have a user defined function (that is conveniently in a custom ribbon). The purpose of the function is to automatically name ranges with the top most or left most cell that contain some sort of name. I have done some manual error checking and I have done some global scope checking.
Here is the problem. I use the following user defined functions to check the scope of named ranges. Currently everything works perfectly for the top naming. However the horizontal naming, will misidentify locally scoped names (names unique to a sheet). this is an issue.
The problem subs in questions are 'lftregname' and 'hselect'. I've attached the file in case anyone cares to help me debug. I would much appreciate it. The two scoping UDF's I use are the following:
Public Function LclNameExists(MyLName As String) As Boolean
'check local scope
shtname = ActiveSheet.Name
On Error Resume Next
LclNameExists = Len(ThisWorkbook.Names("'" & shtname & "'!" & MyLName).Name) <> 0
End Function
Public Function NameExists(MyHName As String) As Boolean
'check global scope
On Error Resume Next
NameExists = Len(ThisWorkbook.Names(MyHName).Name) <> 0
End Function
Naming.xlsm
Bookmarks