Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy sheet problem

Hello,
I've got the run-time error "Copy method of worksheet class failed"
and is trying to use the MSDN workaround for this problem(se
http://support.microsoft.com/default...4&Product=xlw).

But in the MSDN workaround they only copy cells, I want to cop
everything in the sheet, format also.

Sheets.Add Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste

How to copy everything in the sheet?

Thank you.

Siri

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy sheet problem

the code you show does copy everything in on the sheet. It will copy
formats and so forth. an alternative would be


Sheets("Mysheet").copy Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy Destination:=Activesheet.Cells

--
Regards,
Tom Ogilvy



"SiriS " wrote in message
...
Hello,
I've got the run-time error "Copy method of worksheet class failed",
and is trying to use the MSDN workaround for this problem(see

http://support.microsoft.com/default...4&Product=xlw).

But in the MSDN workaround they only copy cells, I want to copy
everything in the sheet, format also.

Sheets.Add Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste

How to copy everything in the sheet?

Thank you.

SiriS


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Copy sheet problem

Cells.Copy copies everything in the sheet. Cells refers to all of the cells
on a worksheet.

Have you tried this technique?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"SiriS " wrote in message
...
Hello,
I've got the run-time error "Copy method of worksheet class failed",
and is trying to use the MSDN workaround for this problem(see

http://support.microsoft.com/default...4&Product=xlw).

But in the MSDN workaround they only copy cells, I want to copy
everything in the sheet, format also.

Sheets.Add Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste

How to copy everything in the sheet?

Thank you.

SiriS


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Copy sheet problem

Hi SiriS,

This should solve it.

Sub CopyToTopSheet()
Dim Rng As Range

Sheets.Add Befo=Sheets(1)
Set Rng = Sheets("MySheet").Cells
Rng.Copy (Range("A1")) 'of the sheet just added.

End Sub

Regards

Paul




"SiriS " wrote in message
...
Hello,
I've got the run-time error "Copy method of worksheet class failed",
and is trying to use the MSDN workaround for this problem(see

http://support.microsoft.com/default...4&Product=xlw).

But in the MSDN workaround they only copy cells, I want to copy
everything in the sheet, format also.

Sheets.Add Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste

How to copy everything in the sheet?

Thank you.

SiriS


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy sheet problem


Actually that just raises an error because of your improper use of
parentheses around the Range("A1").

--
Regards,
Tom Ogilvy

"Paulw2k" wrote in message
...
Hi SiriS,

This should solve it.

Sub CopyToTopSheet()
Dim Rng As Range

Sheets.Add Befo=Sheets(1)
Set Rng = Sheets("MySheet").Cells
Rng.Copy (Range("A1")) 'of the sheet just added.

End Sub

Regards

Paul




"SiriS " wrote in message
...
Hello,
I've got the run-time error "Copy method of worksheet class failed",
and is trying to use the MSDN workaround for this problem(see


http://support.microsoft.com/default...4&Product=xlw).

But in the MSDN workaround they only copy cells, I want to copy
everything in the sheet, format also.

Sheets.Add Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste

How to copy everything in the sheet?

Thank you.

SiriS


---
Message posted from http://www.ExcelForum.com/







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy sheet problem

Sorry, I did not explain correctly. My problem is I have buttons, graph
and drawingobjects in my sheet that I would like to copy, not just th
cells; I do want to copy everything in the sheet.

Do I have to do like this:

Sheets.Add Befo=Sheets(1) 'Copy Cells
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste
Sheets("Mysheet").DrawingObjects.Copy 'Copy drawingobjects
Sheets(ActiveSheet.Name).Paste
....
'Copy graphs etc.

and so on, for every type of object in the sheet?


Regards
Siri

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy sheet problem

My second suggestion would solve that problem.

--
Regards,
Tom Ogilvy


"SiriS " wrote in message
...
Sorry, I did not explain correctly. My problem is I have buttons, graphs
and drawingobjects in my sheet that I would like to copy, not just the
cells; I do want to copy everything in the sheet.

Do I have to do like this:

Sheets.Add Befo=Sheets(1) 'Copy Cells
Sheets("Mysheet").Cells.Copy
Sheets(ActiveSheet.Name).Paste
Sheets("Mysheet").DrawingObjects.Copy 'Copy drawingobjects
Sheets(ActiveSheet.Name).Paste
...
'Copy graphs etc.

and so on, for every type of object in the sheet?


Regards
SiriS


---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy sheet problem

Hi Tom Ogilvo,

do you mean by writing

Sheets("Mysheet").copy Befo=Sheets(1)
Sheets("Mysheet").Cells.Copy Destination:=Activesheet.Cells

?

But I can not use

Sheets("Mysheet").copy Befo=Sheets(1),

since that will raise the run-time error "Copy method of workshee
class failed" I mentioned in my first message (the run-time erro
occurs when I have copied the sheet many times in a loop, se
Microsofts Knowledge Base-artikel - 177634 ).

Regards,
Siri

--
Message posted from http://www.ExcelForum.com

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
copy rows from one Data sheet to another sheet based on cell conte John McKeon Excel Discussion (Misc queries) 2 May 15th 10 06:49 AM
Auto Copy/autofill Text from sheet to sheet if meets criteria Joyce Excel Discussion (Misc queries) 0 November 20th 08 11:05 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM
For Tom Ogilvy re Copy Sheet Problem Jim[_34_] Excel Programming 1 January 3rd 04 02:41 PM
Copy Sheet Problem Jim[_34_] Excel Programming 8 January 2nd 04 11:50 AM


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

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

About Us

"It's about Microsoft Excel"