PC Review


Reply
Thread Tools Rate Thread

Copying cells to another worksheet

 
 
Derrick Salmon
Guest
Posts: n/a
 
      7th Dec 2006
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 With Quote
 
 
 
 
=?Utf-8?B?QWxvaw==?=
Guest
Posts: n/a
 
      7th Dec 2006
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(xlCellTypeLastCell)).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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying worksheet cells into another worksheet using autofill SunnySD Microsoft Excel Misc 3 10th Sep 2008 10:32 PM
Copying a worksheet witrh protected cells to a new worksheet =?Utf-8?B?Sm9obg==?= Microsoft Excel Worksheet Functions 1 1st Feb 2006 02:19 PM
Re: Copying a worksheet witrh protected cells to a new worksheet Tiscali NewsGroup Microsoft Excel Worksheet Functions 0 31st Jan 2006 11:11 PM
copying cells to another worksheet =?Utf-8?B?TXVycGg=?= Microsoft Excel Worksheet Functions 3 12th May 2005 02:38 PM
Copying cells or worksheet - Help! Dan E Microsoft Excel Discussion 6 15th Apr 2004 11:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:45 AM.