+ Reply to Thread
Results 1 to 5 of 5

Is Range ?

  1. #1
    Gary''s Student
    Guest

    Is Range ?

    I need a simple Boolean function that, given a string as an input, will
    return TRUE if the string can be converted directly into a range, otherwise
    FALSE. For example:

    A1
    Sheet3!F20
    [Book1.xls]Sheet1!$B$2

    should all return TRUE, but:

    A1+A2
    A1+1

    should all return FALSE

    Thanks in advance
    --
    Gary''s Student

  2. #2
    Bob Phillips
    Guest

    Re: Is Range ?

    Function IsRange(rng As String)
    Dim rngTemp As Range

    On Error Resume Next
    Set rngTemp = Range(rng)
    On Error GoTo 0

    IsRange = Not rngTemp Is Nothing

    End Function


    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
    news:52A00A09-8162-4FB2-B6AA-2DE7CDE7E292@microsoft.com...
    > I need a simple Boolean function that, given a string as an input, will
    > return TRUE if the string can be converted directly into a range,

    otherwise
    > FALSE. For example:
    >
    > A1
    > Sheet3!F20
    > [Book1.xls]Sheet1!$B$2
    >
    > should all return TRUE, but:
    >
    > A1+A2
    > A1+1
    >
    > should all return FALSE
    >
    > Thanks in advance
    > --
    > Gary''s Student




  3. #3
    Gary''s Student
    Guest

    Re: Is Range ?

    Thank you Bob. I never considered letting the RANGE() function do the work
    for me.
    --
    Gary's Student


    "Bob Phillips" wrote:

    > Function IsRange(rng As String)
    > Dim rngTemp As Range
    >
    > On Error Resume Next
    > Set rngTemp = Range(rng)
    > On Error GoTo 0
    >
    > IsRange = Not rngTemp Is Nothing
    >
    > End Function
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
    > news:52A00A09-8162-4FB2-B6AA-2DE7CDE7E292@microsoft.com...
    > > I need a simple Boolean function that, given a string as an input, will
    > > return TRUE if the string can be converted directly into a range,

    > otherwise
    > > FALSE. For example:
    > >
    > > A1
    > > Sheet3!F20
    > > [Book1.xls]Sheet1!$B$2
    > >
    > > should all return TRUE, but:
    > >
    > > A1+A2
    > > A1+1
    > >
    > > should all return FALSE
    > >
    > > Thanks in advance
    > > --
    > > Gary''s Student

    >
    >
    >


  4. #4
    Dana DeLouis
    Guest

    Re: Is Range ?

    Just another option:

    Function IsRange(s As String) As Boolean
    On Error Resume Next
    IsRange = Range(s).Address <> vbNullString
    End Function

    --
    HTH. :>)
    Dana DeLouis
    Windows XP, Office 2003


    "Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
    news:52A00A09-8162-4FB2-B6AA-2DE7CDE7E292@microsoft.com...
    >I need a simple Boolean function that, given a string as an input, will
    > return TRUE if the string can be converted directly into a range,
    > otherwise
    > FALSE. For example:
    >
    > A1
    > Sheet3!F20
    > [Book1.xls]Sheet1!$B$2
    >
    > should all return TRUE, but:
    >
    > A1+A2
    > A1+1
    >
    > should all return FALSE
    >
    > Thanks in advance
    > --
    > Gary''s Student




  5. #5
    Gary''s Student
    Guest

    Re: Is Range ?

    Thank you Dana
    --
    Gary''s Student


    "Dana DeLouis" wrote:

    > Just another option:
    >
    > Function IsRange(s As String) As Boolean
    > On Error Resume Next
    > IsRange = Range(s).Address <> vbNullString
    > End Function
    >
    > --
    > HTH. :>)
    > Dana DeLouis
    > Windows XP, Office 2003
    >
    >
    > "Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
    > news:52A00A09-8162-4FB2-B6AA-2DE7CDE7E292@microsoft.com...
    > >I need a simple Boolean function that, given a string as an input, will
    > > return TRUE if the string can be converted directly into a range,
    > > otherwise
    > > FALSE. For example:
    > >
    > > A1
    > > Sheet3!F20
    > > [Book1.xls]Sheet1!$B$2
    > >
    > > should all return TRUE, but:
    > >
    > > A1+A2
    > > A1+1
    > >
    > > should all return FALSE
    > >
    > > Thanks in advance
    > > --
    > > Gary''s Student

    >
    >
    >


+ 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