【问题标题】:On VBA excel 2010, i keep getting a runtime error '1004' where the PasteSpecial method of a range class failed在 VBA excel 2010 上,我不断收到运行时错误“1004”,其中范围类的 PasteSpecial 方法失败
【发布时间】:2013-02-22 05:49:25
【问题描述】:

我不断收到运行时错误“1004”,这表示我的范围类的 pastespecial 方法失败。我要做的就是剪下 2 个范围并将它们粘贴到它旁边的一个单元格中,这样我就可以创建一个开放的空范围。由于某种原因,范围类的 pastespecial 方法失败了,我不知道为什么。下面是代码:


Sub ProductivityMacro()

 Dim rDelete As Range

 Dim rCut As Range

 Dim rPaste As Object

 Set rDelete = Range("A:A,C:D,F:J,M:BD")

    rDelete.Delete (xlShiftToLeft)

 Set rCut = Range("C:D")

    rCut.Cut

 Set rPaste = Range("E1")

    rPaste.PasteSpecial xlPasteValues
End Sub

【问题讨论】:

    标签: excel runtime-error excel-2010 copy-paste vba


    【解决方案1】:
    Sub ProductivityMacro()
    
        Dim rDelete As Range
    
        Dim rCut As Range
    
        Dim rPaste As Object
    
        Set rDelete = Range("A:A,C:D,F:J,M:BD")
    
        rDelete.Delete (xlShiftToLeft)
    
        Set rCut = Range("C:D")
    
        rCut.Cut Range("E1")
    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多