+ Reply to Thread
Results 1 to 4 of 4

Does Named range exist?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-22-2010
    Location
    USA
    MS-Off Ver
    2010
    Posts
    24

    Does Named range exist?

    How do I check to see if a named range exists in VB

    range TSF for example?
    Thanks
    Last edited by Cbrehm; 05-07-2011 at 08:11 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Does Named range exist?

    To check the existence of the named range 'snb':

    Sub tst()
       msgBox  [isref(snb)]
    End Sub
    Last edited by snb; 05-07-2011 at 07:41 AM.



  3. #3
    Registered User
    Join Date
    07-22-2010
    Location
    USA
    MS-Off Ver
    2010
    Posts
    24

    Re: Does Named range exist?

    Quote Originally Posted by snb View Post
    To check the existence of the named range 'snb':

    Sub tst()
       msgBox  [isref(snb)]
    End Sub
    Thank you for your help

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Does Named range exist?

    Alternative as UDF

    The following VBA procedure will return TRUE if the name specified in TheName exists, or will return FALSE otherwise.
    [/code]
    Function NameExists(TheName As String) As Boolean
    On Error Resume Next
    NameExists = Len(ThisWorkbook.Names(TheName).Name) <> 0
    End Function[/code]
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1