View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default Copying cells to another worksheet

Derrick,
Sorry but please ignore my earlier reply as it will not work in all cases.
So you are better off using the following:

Worksheets("A").Range(Worksheets("A").Range("A1"), Worksheets("A").Cells.SpecialCells(xlCellTypeLastC ell)).Copy Worksheets("B").Range("A1")

Note that there is a space character only after Copy and the entire command
should be in one line.(Unless you use the line continuation character.)

Alok
"Derrick Salmon" wrote:

Thought this would be simple - its not been today.

I have a workbook with several worksheets and need VBA code to copy the
contents of worksheet "A" to worksheet "B". Both worksheets "A" and
"B" exist before the macros are executed.

Every attempt today has left worksheet B unchanged (essentially empty
except for 4 initial header rows which existed before the attempt at
copying) or has created, then opened another workBook and copied the
contents to worksheet "B" in the new workbook.

Suggestions ?

cheers


Derrick