View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Can you use a Range $N$xx:$Q$xx in Target.Address?

Yep. There is no "something" in VBA.

I find that this can be confusing
if not xxx is nothing then
'do AAA
else
'do BBB
end if

I just change it to:
if xxx is nothing then
'do BBB
else
'do AAA
end if


I have lots of code that looks like:

if myobject is nothing then
'do nothing
else
myobject.name = "asdf"
end if

I find my brain hurts less.

Dave wrote:

On Thu, 29 Sep 2005 16:49:27 -0400, "Tom Ogilvy"
wrote:

Hi Tom,

May I ask you a question on this reply please ?

Why did you use 'If Not ....... is nothing' rather than 'If ..... is
something'.

Please don't get me wrong, I'm not being picky or anything, but what
I'd like to know - and I guess it's something to do with the 'nothing'
bit - is it because there is no opposite to 'nothing' in this
intersect statement ?

I hope I have made sense here - I'm trying to understand the reasoning
behind the negative of nothing.

Regards,
Dave

It should be:

if not intersect(Target, Range("N" & j & ":Q" & j)) is nothing then


--

Dave Peterson