+ Reply to Thread
Results 1 to 2 of 2

Recorded macro is having copy and paste error

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-02-2012
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    452

    Recorded macro is having copy and paste error

    I am getting an error on this. The code and also the trouble area is posted. What I did is copy a column of data, went to the bottom right cell of a table, hit tab to add new row, then paste special, paste as values and transpose. The error message is PasteSpecial method of Range class failed. How can this be corrected?

    Sub Macro2()
    '
    ' Macro2 Macro
    '
    
    '
        Range("R2").Select
        Range(Selection, Selection.End(xlDown)).Select
        Range("R2:R170").Select
        Selection.Copy
        Sheets("DATA").Select
        ActiveWindow.ScrollColumn = 135
        ActiveWindow.ScrollColumn = 87
        ActiveWindow.ScrollColumn = 31
        ActiveWindow.ScrollColumn = 1
        Range("Ex_Data[[#Headers],[Macrocycle]]").Select
        Selection.End(xlDown).Select
        Selection.End(xlToRight).Select
        Selection.ListObject.ListRows.Add AlwaysInsert:=False
        ActiveCell.Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=True
        Sheets("Calculator").Select
        Application.CutCopyMode = False
        Range("W1").Select
    End Sub
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=True

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Recorded macro is having copy and paste error

    It seems to work when you insert the row before pasting transposed values, so try that first.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] RECORDED MACRO PASTE'S DATE DIFFERENTLY TO MANUAL PASTE
    By Pauldecan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM

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