none
Replacing Selection.Copy with Selection.Cut returns error, why? RRS feed

  • Question

  • Hello,

    I have the following code snippet:

    
    analysisBook.Worksheets("Sheet1").Range(Cells(1, smallestColumn), Cells(60, (smallestColumn + 1))).Select
    
    Selection.Copy
    
    analysisBook.Worksheets("Sheet1").Cells(emptyRow, 1).PasteSpecial

    I am trying to replace Selection.Copy with Selection.Cut however when I do this and compile, I get runtime error 1004: PasteSPecial method of range class failed.

    Please can someone explain to me why this is happening? Also if there are any suggestions at alternative methods that would very much be appreciated!

    Thanks in advance,

    Christian

    Wednesday, May 6, 2015 10:24 AM

Answers

  • Re: replace Selection.Copy with Selection.Cut

    Replace...    Selection.Cut
    With...         Selecton.Cut Destination:=analysisBook.Worksheets("Sheet1").Cells(emptyRow, 1)

    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Proposed as answer by Wouter Defour Monday, May 18, 2015 2:28 PM
    • Marked as answer by L.HlModerator Monday, May 18, 2015 11:54 PM
    • Edited by James Cone Sunday, October 23, 2016 4:35 AM
    Friday, May 8, 2015 11:43 AM

All replies

  • Hello,

    I can not tell you why this is not working.

    But following worked for me, maybey you can adapt your code?

    analysisBook.Worksheets("Sheet1").Range(Cells(1, smallestColumn), Cells(60, (smallestColumn + 1))).Select

    Selection.Copy

    Set rg = analysisBook.Worksheets("Sheet1").Cells(emptyRow, 1).

    Call Worksheets("Sheet1").Paste(rg)

    Hope it helps,

    Wouter

    Wednesday, May 6, 2015 10:58 AM
  • Re: replace Selection.Copy with Selection.Cut

    Replace...    Selection.Cut
    With...         Selecton.Cut Destination:=analysisBook.Worksheets("Sheet1").Cells(emptyRow, 1)

    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Proposed as answer by Wouter Defour Monday, May 18, 2015 2:28 PM
    • Marked as answer by L.HlModerator Monday, May 18, 2015 11:54 PM
    • Edited by James Cone Sunday, October 23, 2016 4:35 AM
    Friday, May 8, 2015 11:43 AM