VBA Error: paste method of worksheet class failed 1004

usmanhussain13

New Member
Joined
Jan 29, 2019
Messages
11
Hi All,


Im getting the following error, paste method of worksheet class failed. when i Debug it takes me to the below which ive changed to BOLD font.

Code:
Sub TheLatestETSResendPart2()
'
' TheLatestETSResendPart2 Macro
'
    Columns("M:M").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("M2").Select
    ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],8)"
    Range("M2").Select
    Selection.AutoFill Destination:=Range("M2:M35")
    Range("M2:M35").Select
    Range("M1").Select
    ActiveCell.FormulaR1C1 = "ETS PSET"
    Columns("M:M").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Columns("L:L").Select
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlToLeft
    Columns("M:M").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("M2").Select
[B][U][COLOR=#000000]    ActiveSheet.Paste[/COLOR][/U][/B]
    Selection.Copy
    Range("M3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M2").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M4").Select
    ActiveSheet.Paste
    Range("M4").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=IF(RC[-1]<>R[1]C[-1],""PSET Changed from ""&RC[-1]&"" to ""&R[1]C[-1],""SSI Variance"")"
    Range("M4").Select
    Selection.Copy
    Range("M5").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("M4").Select
    Selection.Copy
    Range("M6").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M7").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M8").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M8").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M10").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M11").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M10").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M12").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M13").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M12").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M14").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M15").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M14").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M16").Select
    ActiveSheet.Paste
    Range("M16").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M17").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M16").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M18").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M19").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M20").Select
    ActiveSheet.Paste
    Range("M20").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M21").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M20").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M22").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M23").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M22").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M24").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M25").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M24").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M26").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M27").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M26").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M28").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M29").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M28").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M30").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M31").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M30").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M32").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M33").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M32").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M34").Select
    ActiveSheet.Paste
    Range("M34").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M35").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M34").Select
    Application.CutCopyMode = False
    Selection.Copy
    ActiveWindow.SmallScroll Down:=18
    Range("M36").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M37").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M36").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M38").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M39").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M38").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M40").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M41").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M40").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M42").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M43").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M42").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M44").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M45").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M44").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M46").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M47").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M46").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M48").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M49").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M48").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M50").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M51").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=9
    Range("M50").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M52").Select
    ActiveSheet.Paste
    Range("M52").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M53").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M52").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M54").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M55").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M54").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M56").Select
    ActiveSheet.Paste
    Range("M56").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M57").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M56").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M58").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M59").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M58").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M60").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=15
    Application.CutCopyMode = False
    Selection.Copy
    Range("M61").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M60").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M62").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M63").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M62").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M64").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M65").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M64").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M66").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M67").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M66").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M68").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M69").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M70").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M71").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M70").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M72").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    Application.CutCopyMode = False
    Selection.Copy
    Range("M73").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M72").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M74").Select
    ActiveSheet.Paste
    Range("M74").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M75").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M74").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M76").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=6
    Range("M76").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M77").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M76").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M78").Select
    ActiveSheet.Paste
    Range("M78").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M79").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M78").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M80").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M81").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M80").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M82").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M83").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M82").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M84").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    Application.CutCopyMode = False
    Selection.Copy
    Range("M85").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M84").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M86").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M87").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M86").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M88").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M89").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M88").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M90").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    Range("M90").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M91").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M90").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M92").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M93").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=12
    Range("M92").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M94").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M95").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M94").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M96").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M97").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M96").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M98").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M99").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M98").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M100").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M101").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M100").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M102").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M103").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M102").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M104").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M105").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M104").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M106").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M107").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M106").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M108").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M109").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M108").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M110").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M111").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M110").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M112").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    Application.CutCopyMode = False
    Selection.Copy
    Range("M113").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M112").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M114").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M115").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M114").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M116").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M117").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M116").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M118").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M119").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M118").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M120").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M121").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=12
    Range("M120").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M122").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M123").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M122").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M124").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M125").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M124").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M126").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M127").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M126").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M128").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M129").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M128").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M130").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M131").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M130").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M132").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M133").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=12
    Range("M132").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M134").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M135").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M134").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M136").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M137").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M136").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M138").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M139").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Selection.Copy
    Application.CutCopyMode = False
    Range("M138").Select
    Selection.Copy
    Range("M140").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M141").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M140").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M142").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M143").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M142").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M144").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M145").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M144").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M146").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M147").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M146").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M148").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M149").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M148").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M150").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M151").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M150").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M152").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M153").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M152").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M154").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=9
    Range("M154").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M155").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M154").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M156").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M157").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M156").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M158").Select
    ActiveSheet.Paste
    Range("M158").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M159").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M158").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M160").Select
    ActiveSheet.Paste
    Range("M160").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M161").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M160").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M162").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    Range("M162").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M163").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M162").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M164").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M165").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M164").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M166").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M167").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M166").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M168").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M169").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M168").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M170").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M171").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M170").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M172").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M173").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M172").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M174").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M175").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M174").Select
    Application.CutCopyMode = False
    Selection.Copy
    Application.CutCopyMode = False
    Selection.Copy
    Range("M176").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M177").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M176").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M178").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M179").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M178").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M180").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M181").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=6
    Range("M180").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M182").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M183").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M182").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M184").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M185").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M184").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M186").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M187").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWindow.SmallScroll Down:=9
    Range("M186").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M188").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M189").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M188").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M190").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M191").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M190").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M192").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M193").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M192").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M194").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M195").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M194").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M196").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=9
    Application.CutCopyMode = False
    Selection.Copy
    Range("M197").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M196").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M198").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M199").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M198").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M200").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M201").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M200").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M202").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Selection.Copy
    Range("M203").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M202").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M204").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=6
    Range("M204").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M205").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("M204").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M206").Select
    ActiveSheet.Paste
    Range("M206").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("M207").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("M1").Select
    ActiveCell.FormulaR1C1 = "SSI or PSET Change"
    Range("N3").Select
    Columns("M:M").ColumnWidth = 17.43
    Sheets("Sheet1").Select
    Range("B9").Select
    ActiveWorkbook.RefreshAll
    With ActiveSheet.PivotTables("PivotTable2").PivotFields("SSI or PSET Change")
        .Orientation = xlRowField
        .Position = 3
    End With
    Range("F25").Select
End Sub
 
Last edited by a moderator:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Code:
[COLOR=#ff0000]Columns("M:M").Select
Selection.Copy[/COLOR]
[COLOR=#333333]Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _[/COLOR]
[COLOR=#333333]:=False, Transpose:=False[/COLOR]
[COLOR=#333333]Columns("L:L").Select[/COLOR]
[COLOR=#333333]Application.CutCopyMode = False[/COLOR]
[COLOR=#333333]Selection.Delete Shift:=xlToLeft[/COLOR]
[COLOR=#333333]Columns("M:M").Select[/COLOR]
[COLOR=#333333]Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove[/COLOR]
[COLOR=#ff0000]Range("M2").Select
[B][U]ActiveSheet.Paste[/U][/B][/COLOR]
Notice the parts I highlighted in red. You selected the entire column to copy (that means ALL possible cells in columns M, rows 1 through 1048576).
However, you selected M2 as the first cell to paste this range to. This is how possible, since you are copy 1048576 rows, the last row would push it off the page (1048577).
So, you either need to select M1 to to paste this range to, or reduce the number of rows you are copying so it is less than the maximum number possible.
 
Upvote 0
To add to Joe4's comments, you have this line:

Application.CutCopyMode = False

between the Copy and activesheet.paste which clears the clipboard leaving nothing to paste.
 
Upvote 0
In addition to the above, having this line between the copy & paste
Code:
Selection.Delete Shift:=xlToLeft
will also prevent the paste from working
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top