VBA Run-time error 1004 when trying to copy paste cells in a separate sheet

本秂侑毒 提交于 2019-12-01 14:17:28

Update this section:

If SaveRedAns = 6 Then
        With AccDnn
            .Range(.Cells(2, 71), .Cells(RangéeFinAcc - 1, 87)).Copy
            .Cells(RangéeFinRed - 18, 71).PasteSpecial (xlPasteValues)
        End With
        With DrpRed
            .Range(.Cells(19, 1), .Cells(RangéeFinRed, 16)).Copy
        End With
        AccDnn.Cells(2, 75).PasteSpecial (xlPasteValues)
    Else: SaveRedAns = 7
        Application.ScreenUpdating = True
        Exit Sub
End If

Or without using With statements:

If SaveRedAns = 6 Then
        AccDnn.Range(AccDnn.Cells(2, 71), AccDnn.Cells(RangéeFinAcc - 1, 87)).Copy
        AccDnn.Cells(RangéeFinRed - 18, 71).PasteSpecial (xlPasteValues)
        DrpRed.Range(DrpRed.Cells(19, 1), DrpRed.Cells(RangéeFinRed, 16)).Copy
        AccDnn.Cells(2, 75).PasteSpecial (xlPasteValues)
    Else: SaveRedAns = 7
        Application.ScreenUpdating = True
        Exit Sub
End If
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!