Range.Paste - Object doesn't support this property or method

前端 未结 4 675
再見小時候
再見小時候 2021-01-06 06:14

I\'ve got a very simple procedure that copies a range from one workbook and pastes it into another; the issue is, I\'m getting the error in the title on the paste

4条回答
  •  天涯浪人
    2021-01-06 06:44

    You can Copy and Paste Ranges between sheets (and workbooks) using 1 line of code, just replace your code with the line below:

    x.Sheets(1).Range("A1").CurrentRegion.Copy y.Sheets("DTR").[a1] 
    

    If you want to use the PasteSpecial method, you got to do it in 2 lines, but you need to add a parameter after the PasteSpecial , like xlValues, etc.

    x.Sheets(1).Range("A1").CurrentRegion.Copy
    y.Sheets("DTR").[a1].PasteSpecial xlValues
    

提交回复
热议问题