C Charles Maxson Jan 6, 2004 #2 Micheal, Here is a function (with a test sub) that will return t/or/f if your name exists: Sub Test() MsgBox RangeNameExists("test") End Sub Function RangeNameExists(sRangeName As String) As Boolean Dim rng As Range On Error Resume Next Set rng = Range(sRangeName) If Not rng Is Nothing Then RangeNameExists = True End If End Function
Micheal, Here is a function (with a test sub) that will return t/or/f if your name exists: Sub Test() MsgBox RangeNameExists("test") End Sub Function RangeNameExists(sRangeName As String) As Boolean Dim rng As Range On Error Resume Next Set rng = Range(sRangeName) If Not rng Is Nothing Then RangeNameExists = True End If End Function
J Jake Marx Jan 6, 2004 #3 Hi Michael, Here's another alternative (shorter, but accomplishes the same thing as Charles's): Public Function gbValidRange(rsName As String) As Boolean On Error Resume Next gbValidRange = Len(Range(rsName).Name) End Function -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored]
Hi Michael, Here's another alternative (shorter, but accomplishes the same thing as Charles's): Public Function gbValidRange(rsName As String) As Boolean On Error Resume Next gbValidRange = Len(Range(rsName).Name) End Function -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored]