View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Can you use a Range $N$xx:$Q$xx in Target.Address?

It should be:

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

--
Regards,
Tom Ogilvy


"CRayF" wrote in message
...
I currently have this code and all works fine. I was trying to rewrite the

4
Target statements into one. I tried using this line:
If Not Intersect(Target, Range("N" & j & ":Q" & j)) Then
Instead of the 4 Target statements below but nothing happens?
Can the above statement not be used like this?

--------------------------
src = srcProgramDataInputWs.Range("B3").Value
i = 3
j = 3
Do Until src = ""

If Not Intersect(Target, Range("N" & j & ":Q" & j)) Then
' If Target.Address = "$N$" & j Or _
' Target.Address = "$O$" & j Or _
' Target.Address = "$P$" & j Or _
' Target.Address = "$Q$" & j Then

ActiveWindow.ScrollRow = Target.Row 'Scoll to top of screen
End If
j = j + 12 'add for next set of (12) rows
'Look for the existence of a Race number (no race number will end

loop)
src = srcProgramDataInputWs.Cells(i, 2).Value
Loop
-----------------------------

"Tom Ogilvy" wrote:

no. if you want to test if the target falls in a range

if not intersect(Target, Range("N" & j & ":Q" & j)) then
--
Regards,
Tom Ogilvy