I have a macro in Excel but it shows me error 1004 when I try to paste using Selection.PasteSpecial
.
This error is with Office 365 if I try the same macro with Office 2010 it works ok.
The debugger shows an error in this line:
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
The full code of the module is:
Sub MoveData_Activations()
MoveData_Activations Macro
Dim dayCount As Integer
Dim startCell As String
Dim curCellRef As String
dayCount = 13
startCell = "B3"
If MsgBox("Are you sure you want to rollover the data for a new date?", vbYesNo, "Confirm rollover") = vbYes Then
ActiveSheet.Protect UserInterfaceOnly:=True
Range(startCell).Select
ActiveCell.Cells(-1, 6).Copy
ActiveCell.Cells(-1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
curCellRef = Range(startCell).Address
For i = 1 To dayCount
CopyData curCellRef, False, 6, 24, 2
curCellRef = ActiveCell.Cells(1, 6).Address
Next i
CopyData curCellRef, True, 6, 24, 2
End If
End Sub