#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Intersect

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

RBS

wrote in message
oups.com...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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" wrote in message
...
Instead of ActiveCell do:
Cells(ActiveCell.Row, ActiveCell.Column)

RBS

wrote in message
oups.com...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intersect Line GoodTrouble Charts and Charting in Excel 4 January 29th 08 05:08 PM
Intersect with decimal Nicke Excel Programming 0 November 20th 03 02:02 PM
Intersect Formula??? scrabtree[_2_] Excel Programming 3 October 15th 03 08:30 PM
Intersect Formula VBA Help scrabtree Excel Programming 1 October 15th 03 02:08 PM
Help with If Not Intersect derek Excel Programming 6 July 11th 03 04:39 PM


All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"