+ Reply to Thread
Results 1 to 2 of 2

Debugs with Copy / Paste

  1. #1
    John
    Guest

    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. #2
    Jim Rech
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1