View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Code won't work?

Joe,

I assume you are on another sheet when you get this error? I think it is
because that in these circumstances the first Range refers to Sheet1, but
the second is not fully qualified, so it refers to the active sheet.

Try

With Worksheets("Sheet1")
.Range("J2", .Range("J2").End(xlDown)).Copy
End With


not the dots before the Range keywords.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Joe 90" wrote in message
...
[code]
Worksheets("Sheet1").Select (or Activate)
[end code]

causes a breakout from Application.ScreenUpdating=false

So I am trying to reference the range I need using:

[code]
Worksheets("Sheet1").Range("J2", Range("J2").End(xlDown)). Copy
Worksheets("Sheet2").Range("b2")
[end code]

but I get an object error. I need to reference the range with .End because
the size of range starting at J2 will keep changing.

All/any help greatly appreciated & sorry for the double post (?)

Joe