Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying cells to another worksheet

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Cells to new row on different worksheet SPISO Excel Worksheet Functions 0 April 21st 09 08:23 PM
Copying worksheet cells into another worksheet using autofill SunnySD Excel Discussion (Misc queries) 3 September 10th 08 10:32 PM
copying cells to another worksheet Lynn Excel Worksheet Functions 1 September 11th 06 02:35 PM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM
Copying cells from 1 worksheet to another Jeffries' Ex New Users to Excel 1 August 1st 05 08:18 PM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"