View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Application-defined or object-defined error

Hmm...

Aside from my advice to never use a keyword (e.g., Selection) as a
variable name (because it leads to confusion months down the road when
you go to edit it), I don't know how that would give an
Application-defined or Object-defined error.

How is trigger_area defined? Do you have protection set in std_number?


Does Range("std_number") get set to whatever "xxx" is if you leave out
the "trigger_area" line?



In article ,
Thomas Nielsen wrote:

A very good point; the routine doesn't do much, however,...

Function inSelection(ByRef target As Range, ByRef Selection As Range) As
Boolean
'.---------------
'| The primary (only, actually) reason for having this function is to avoid
'| saying "IF NOT NOTHING THEN" when checking for range intersections and
'| risking serious brain injury from reverse logic - in other words: return
'| true if the range Target defines the range Selection.
'`---------------
inSelection = Not Intersect(target, Selection) Is Nothing
End Function

...other than shield the reader from a double negation :-). I did try to
remove it and use the Intersect() call directly but it didn't help.