View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copying Variable Ranges

With Worksheets("Sheet2")
..Range(.Range("C1"), .Range("H1").End(xlDown)).Copy
End With
Range("K7").PasteSpecial

You need to qualify all range references to point to sheet2.

--
Regards,
Tom Ogilvy

"Alec" wrote in message
...
The following code works for copying a range from C1 up to
the first blank in column H;

Range("C1", Range("H1").End(xlDown)).Copy
Range("K7").PasteSpecial

But when I try the following code to copy the same amount
of data from sheet 2 I get an error message.

Worksheets("Sheet2").Range("C1", Range("H1").End
(xlDown)).Copy
Range("K7").PasteSpecial
Any ideas.
Thanks
Alec