View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to copy a range of cells from one sheet to another

This portion of your code:
Sheets("Compare").Range(Cells(x, 1), Cells(x, z))
could be rewritten as:
Sheets("Compare").Range(activesheet.Cells(x, 1), activesheet.Cells(x, z))

And if Compare isn't the activesheet, then that portion of the code will fail.

It's not really the difference between .cells() and .range(). It's how each of
them are qualified--and if you don't explicitly qualify them, then excel will
use what it thinks is right.

And that's not always a good thing!

Revolvr wrote:

<<snipped
Thanks. This method works. I guess the confusion is that .Cells works
with either Range or Sheets, and I had assumed if the sheet of the
range is specified, the Cells would be the same.


--

Dave Peterson