+ Reply to Thread
Results 1 to 3 of 3

Determining if a named range exists

  1. #1
    a
    Guest

    Determining if a named range exists

    Hello,

    Is there a way to determine whether a named range exists in a workbook?
    I would think there would be a way. I'm trying to put together an
    if statement - but I don't know the syntax. What I'm looking for is "If
    the range "first" exists in the workbook, then do this, else . . ."

    Any help would be greatly appreciated.

    Thanks in advance.

    Anita


  2. #2
    Bob Phillips
    Guest

    Re: Determining if a named range exists

    Sub RangeNameTes()
    Dim rng As Range

    On Error Resume Next
    Set rng = Range("myRangeNAme")
    On Error GoTo 0
    If Not rng Is Nothing Then
    ' it exists
    Else
    ' it doesn't exist
    End If

    End Sub

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "a" <graylatt@earthlink.net> wrote in message
    news:Z69vf.1180$WY5.641@newsread2.news.pas.earthlink.net...
    > Hello,
    >
    > Is there a way to determine whether a named range exists in a workbook?
    > I would think there would be a way. I'm trying to put together an
    > if statement - but I don't know the syntax. What I'm looking for is "If
    > the range "first" exists in the workbook, then do this, else . . ."
    >
    > Any help would be greatly appreciated.
    >
    > Thanks in advance.
    >
    > Anita
    >




  3. #3
    a
    Guest

    Re: Determining if a named range exists

    Bob,

    Thanks!

    Anita

    Bob Phillips wrote:

    > Sub RangeNameTes()
    > Dim rng As Range
    >
    > On Error Resume Next
    > Set rng = Range("myRangeNAme")
    > On Error GoTo 0
    > If Not rng Is Nothing Then
    > ' it exists
    > Else
    > ' it doesn't exist
    > End If
    >
    > End Sub
    >



+ 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