Hi Russ,
You could use the Evaluate function along with the TypeName function to see
if you have a valid range in the active workbook:
If TypeName(Evaluate("test")) = "Range" Then
MsgBox "Name found"
Else
MsgBox "Name not found"
End If
If you're looking on a specific worksheet, you can do this:
If TypeName(Workbooks("Book1.xls").Sheets("Sheet1" _
).Evaluate("test")) = "Range" Then
I prefer the On Error method in this case, as it allows more flexibility.
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
rrobelen wrote:
Thanks Marx,
I thought there might be a simple test sort of like the iserror class
of tests but I guess not. I thought of using this but was looking
for the simple one. Thanks i am sure is more bullet proof then mine
would have been. Again thanks for the quick response. Regards,
Russ
----- Jake Marx wrote: -----
Hi rrobelen,
You can simply trap the error that may occur if it doesn't exist:
Public Function gbDoesNameExist(rwb As Workbook, _
rsName As String) As Boolean
On Error Resume Next
gbDoesNameExist = Len(rwb.Names(rsName).Name)
On Error GoTo 0
End Function
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address
unmonitored]
rrobelen wrote:
I know this must be trivial but I can't find it. How do i
test to see that a range name exists?