View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Howard Howard is offline
external usenet poster
 
Posts: 536
Default If .Column 7 And .Row 25 then go to B8

On Friday, February 22, 2013 8:56:42 AM UTC-8, GS wrote:
Howard formulated the question :

On Friday, February 22, 2013 8:22:10 AM UTC-8, GS wrote:


Oops! ..missing closing parenthesis...








If Not Intersect(Target, Range($B$8:$G$25)) Then Exit Sub








--




Garry








Free usenet access at http://www.eternal-september.org




Classic VB Users Regroup!




comp.lang.basic.visual.misc




microsoft.public.vb.general.discussion




Hmmmmm! The revised does the same thing.




Howard




Yes, but with 1/4 the required processing! Your If construct requires

VBA to do 4 processes (1 for each condition) whereas the Intersect

function does the same thing in a single process. That makes using

Intersect() 300% more efficient in this context.



--

Garry



Free usenet access at http://www.eternal-september.org

Classic VB Users Regroup!

comp.lang.basic.visual.misc

microsoft.public.vb.general.discussion


Hi Garry and Claus,

I'm feeling like a real troublemake here.

I have tried all corrected versions the two of you offered. If I make entries outside the B8:G25 range I get the familiar "Run-time error 91
Object... Block variable not set" Code line is yellow highlighted up to but excluding Exit Sub.

On Error Resume Next seems to cure it, is it proper to do that?

(Maybe my Excel has the Flu, or maybe I do.)

Howard