Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I got a "copy method of worksheet class failed" error when trying to copy
sheet2. Sheet2 is hidden. here is the code: Sheets("Sheet2").Copy Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You will get that message when you copy a hidden sheet without specifying
Befo= or After:=. If the sheet is not hidden, it will create a new workbook with only that sheet in it. "sam" wrote in message ... I got a "copy method of worksheet class failed" error when trying to copy sheet2. Sheet2 is hidden. here is the code: Sheets("Sheet2").Copy Thanks in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you goto the doctor and say "it hurts when I do this", the doctor might
say "Dont do that" -- Don Guillett Microsoft MVP Excel SalesAid Software "sam" wrote in message ... I got a "copy method of worksheet class failed" error when trying to copy sheet2. Sheet2 is hidden. here is the code: Sheets("Sheet2").Copy Thanks in advance |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
P.Sl
For best results, unhide the worksheet to copy it, then re-hide it if needed. Otherwise, you can get some strange results. "sam" wrote in message ... I got a "copy method of worksheet class failed" error when trying to copy sheet2. Sheet2 is hidden. here is the code: Sheets("Sheet2").Copy Thanks in advance |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When you don't specify a parameter after the Copy method, a copy of
the worksheet is created as the only worksheet in a newly created workbook. However, a workbook must contain at least one visible worksheet. Your code fails because it instructs Excel to create a new workbook with no visible worksheet. Try Application.ScreenUpdating = False With ThisWorkbook.Worksheets("Sheet2") .Visible = True .Copy .Visible = False '''' ' At this point, the newly created workbook containing ' only Sheet2 is the visible ActiveWorkbook. To return ' back to the original workbook, uncomment the line below: '''' '.Parent.Activate End With Application.ScreenUpdating = True Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 7 Aug 2009 15:15:01 -0700, sam wrote: I got a "copy method of worksheet class failed" error when trying to copy sheet2. Sheet2 is hidden. here is the code: Sheets("Sheet2").Copy Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy method of Worksheet class failed | Excel Programming | |||
Copy method of worksheet class failed | Excel Programming | |||
Copy method of worksheet class failed - help! | Excel Programming | |||
Copy method of Worksheet class failed | Excel Programming | |||
Copy Method of Worksheet Class Failed | Excel Programming |