+ Reply to Thread
Results 1 to 6 of 6

PasteSpecial method of Range class failed

  1. #1
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    PasteSpecial method of Range class failed

    I recorded the following macro to copy and paste special (values) a range of numbers in a row.

    More precisely, I have created 4 scenarios for my data and I want to select my scenario from a drop-down menu that I have on cell C2 and then copy and paste my results for the 4 different scenarios in a table that I have created in the same sheet and that will have hard-coded data.

    The error I get is the one I wrote in the title: PasteSpecial method of Range class failed

    Maybe I am wrong but it seems to me that the macro does not go to cell C2 to change the scenario from the drop-down menu.

    I would be grateful if anybody can help.

    Thanks very much!

    Macro below:

    Range("C51").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O18").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C53").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O25").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C51").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O19").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C53").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O26").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C51").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C53").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O27").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C51").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O21").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("C53").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range("O28").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: PasteSpecial method of Range class failed

    Eh, you don't actually seem to be copying anything, so there's nothing to paste.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: PasteSpecial method of Range class failed

    Apologies for the code tags.. I will use them next time.

    Is it possible that the reason is that I used ctrl + C when recording the macro to copy my data?

    Thanks very much.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: PasteSpecial method of Range class failed

    Not sure but there's nothing being copied in the code you posted.

    I'm not sure what you want to copy but I would have expect to see code like this.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-13-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: PasteSpecial method of Range class failed

    Thanks so much Norie.

    Now the copy/paste works.

    However it doesn't change the scenarios that I have in a drop-down menu on cell C2. Any suggestion on how to insert that in the code?

    Thanks very very much

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: PasteSpecial method of Range class failed

    Can you upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

+ 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] PasteSpecial method of Range class failed...I don't get it.
    By mvparker79 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2014, 10:09 AM
  2. [SOLVED] PasteSpecial Method of Range Class Failed
    By mrbickelsworth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-05-2013, 06:40 PM
  3. pastespecial method of range class failed
    By Fansons1 in forum Access Tables & Databases
    Replies: 2
    Last Post: 12-28-2011, 04:56 PM
  4. PasteSpecial method of Range class failed
    By reborges in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2007, 02:27 PM
  5. PasteSpecial method of Range class failed
    By windsor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-06-2005, 06:05 PM

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