+ Reply to Thread
Results 1 to 3 of 3

Intersect

  1. #1

    Intersect

    I run into a code "91" error when I perform this function


    sub mymacro()

    If application.intersect(Activecell, Range("A1:IV16")) then
    msgbox("wrong area")
    else
    msgbox("better")
    end if

    end sub

    I don't have anything declared, can anyone help?


  2. #2
    RB Smissaert
    Guest

    Re: Intersect

    Instead of ActiveCell do:
    Cells(ActiveCell.Row, ActiveCell.Column)

    RBS

    <[email protected]> wrote in message
    news:[email protected]...
    >I run into a code "91" error when I perform this function
    >
    >
    > sub mymacro()
    >
    > If application.intersect(Activecell, Range("A1:IV16")) then
    > msgbox("wrong area")
    > else
    > msgbox("better")
    > end if
    >
    > end sub
    >
    > I don't have anything declared, can anyone help?
    >



  3. #3
    RB Smissaert
    Guest

    Re: Intersect

    Forgot to say that you also have to deal with the resulting range like this:

    If Not Application.Intersect(Cells(ActiveCell.Row, _
    ActiveCell.Column), Range("A1:A10")) Is Nothing Then

    RBS

    "RB Smissaert" <[email protected]> wrote in message
    news:[email protected]...
    > Instead of ActiveCell do:
    > Cells(ActiveCell.Row, ActiveCell.Column)
    >
    > RBS
    >
    > <[email protected]> wrote in message
    > news:[email protected]...
    >>I run into a code "91" error when I perform this function
    >>
    >>
    >> sub mymacro()
    >>
    >> If application.intersect(Activecell, Range("A1:IV16")) then
    >> msgbox("wrong area")
    >> else
    >> msgbox("better")
    >> end if
    >>
    >> end sub
    >>
    >> I don't have anything declared, can anyone help?
    >>

    >



+ 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