+ Reply to Thread
Results 1 to 4 of 4

Cell lies within range

  1. #1
    Kaval
    Guest

    Cell lies within range

    I think I have seen an elegant way of determining if a particular cell lies
    within a particular range. eg. does cell(x,y) lie inside range(a:b)

    Any ideas?

    Thanks, Kaval

  2. #2
    Bernie Deitrick
    Guest

    Re: Cell lies within range

    Kaval,

    MsgBox Not (Intersect(Cells(x, y), Range("a:b")) Is Nothing)

    HTH,
    Bernie
    MS Excel MVP


    "Kaval" <[email protected]> wrote in message
    news:[email protected]...
    >I think I have seen an elegant way of determining if a particular cell lies
    > within a particular range. eg. does cell(x,y) lie inside range(a:b)
    >
    > Any ideas?
    >
    > Thanks, Kaval




  3. #3
    Norman Jones
    Guest

    Re: Cell lies within range

    Hi Kaval,

    Try something like:

    Sub Tester09()
    Dim rng As Range
    Dim rcell As Range

    Set rng = Range("TEST")
    Set rcell = Range("A2")

    If Not Intersect(rcell, rng) Is Nothing Then
    MsgBox rcell.Address(0, 0) & " lies in the named " _
    & rng.Name.Name & " range"
    Else
    'It does not!

    End If

    End Sub

    ---
    Regards,
    Norman



    "Kaval" <[email protected]> wrote in message
    news:[email protected]...
    >I think I have seen an elegant way of determining if a particular cell lies
    > within a particular range. eg. does cell(x,y) lie inside range(a:b)
    >
    > Any ideas?
    >
    > Thanks, Kaval




  4. #4
    Vasant Nanavati
    Guest

    Re: Cell lies within range

    For example:

    MsgBox Not Intersect (Range("A1"), Range("A2:Z100")) Is Nothing

    --

    Vasant

    "Kaval" <[email protected]> wrote in message
    news:[email protected]...
    > I think I have seen an elegant way of determining if a particular cell

    lies
    > within a particular range. eg. does cell(x,y) lie inside range(a:b)
    >
    > Any ideas?
    >
    > Thanks, Kaval




+ 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