Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Debugs with Copy / Paste

I have the following code that Debug on the "ActiveSheet Paste" that is in large font below and I can't figure it out. The Debug message is "Paste Method of Worksheet Class failed"




Sub Generate_Reports()

Sheets("Figures").Select
Cells.Select
Selection.Copy
Range("A1").Select
Sheets("E-Figures").Visible = True
Sheets("E-Figures").Select
Range("A1").Select
ActiveSheet.Unprotect Password:="pass"
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False
Sheets("Altered").Select
Cells.Select
Selection.Copy
Range("A1").Select
Sheets("E-Altered").Visible = True
Sheets("E-Altered").Select
Range("A1").Select
ActiveSheet.Unprotect Password:="pass"
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False

Sheets("Home").Select
Range("A1").Select

Mail_Reports
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Debugs with Copy / Paste

Whenever you try to paste, if it does not say "Select destination and press
ENTER or choose paste" in Excel's lower left corner, you know that the
clipboard has been cleared. (You can check this when you hit Debug). So
there is nothing to paste. The actions of unhiding a worksheet or
unprotecting it have done this. So do them before you do the Copy.

--
Jim
"John" wrote in message
...
I have the following code that Debug on the "ActiveSheet Paste" that is in
large font below and I can't figure it out. The Debug message is "Paste
Method of Worksheet Class failed"




Sub Generate_Reports()

Sheets("Figures").Select
Cells.Select
Selection.Copy
Range("A1").Select
Sheets("E-Figures").Visible = True
Sheets("E-Figures").Select
Range("A1").Select
ActiveSheet.Unprotect Password:="pass"
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False
Sheets("Altered").Select
Cells.Select
Selection.Copy
Range("A1").Select
Sheets("E-Altered").Visible = True
Sheets("E-Altered").Select
Range("A1").Select
ActiveSheet.Unprotect Password:="pass"
ActiveSheet.Paste
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Visible = False

Sheets("Home").Select
Range("A1").Select

Mail_Reports
End Sub


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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy, paste without file name referenced after paste AusTexRich Excel Discussion (Misc queries) 6 September 23rd 08 02:57 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 12:05 PM.

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"