Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jun 2002
    Location
    Johannesburg, Gauteng, South Africa
    Posts
    59
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Ascertain if a named range exists (Excel 2000)

    Hi, can someone please enlighten me as to what code I need to use to ascertain if a named range (e.g. Data_Range_1) exists in a workbook.

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Ascertain if a named range exists (Excel 2000)

    Here is a simplistic function. Others may come up with a more sophisticated solution.

    Function NameExists(strName As String) As Boolean
    Dim strDummy As String
    On Error Resume Next
    strDummy = ActiveWorkbook.Names(strName).Value
    NameExists = (Err = 0)
    End Function

    Use like this:

    If NameExists("Data_Range_1") Then ...

  3. #3
    Star Lounger
    Join Date
    Jun 2002
    Location
    Johannesburg, Gauteng, South Africa
    Posts
    59
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Ascertain if a named range exists (Excel 2000)

    Thanks, this works fine

Posting Permissions

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