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

前端 未结 4 720
再見小時候
再見小時候 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:31

    The problem with your original code was two-fold.

    1. The Cells.Delete statement appeared after the copy, but a delete action clears the clipboard.

    2. The Paste method is a member of the Sheet object, not the Range object.

    Adjusting your code, that becomes:

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

提交回复
热议问题