Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Brian

SOLVED VBA: How to test if an object (range) is nothing?

This is a discussion on SOLVED VBA: How to test if an object (range) is nothing? within the Excel Questions forums, part of the Question Forums category; I perform an intersection, but sometimes the result is nothing. I have not been able to find a means to ...

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Posts
    113

    Default

    I perform an intersection, but sometimes the result is nothing. I have not been able to find a means to test if isect is nothing.

    Set isect = Application.Intersect(SourceSelection, Range("A10:A65000"))

    I want the equivalent to:
    If isect = "nothing" then msgbox "No relevant data."

    Thanks.

    [ This Message was edited by: Brian on 2002-05-20 14:47 ]

    [ This Message was edited by: Brian on 2002-05-20 17:23 ]

  2. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,702

    Default

    Hello Brian, perhaps the following procedure will be of use:


    Sub SrcSel()
    Dim SourceSelection As Range
    Set SourceSelection = Selection 'Change this to your preference
    If Not Application.Intersect(SourceSelection, _
    Range("A10:A65000")) Is Nothing Then
    MsgBox "No relevant data."
    End If
    End Sub


    _________________
    Cheers, NateO

    [ This Message was edited by: NateO on 2002-05-20 15:41 ]

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Posts
    113

    Default

    Thanks.

    Sorry, oversight on my part.

    I had tried "isnothing" as one word instead of two.

    Thanks again,

    Brian
    James Snyder likes this.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com