Hi all,
I have quite a bizarre error occurring with the code below - when the button is pressed to run this code I get the Run time error 1004 - Paste special method of range class failed. However if I step through the code no error occurs.
The error is occurring at the "paste special" stage of the code.
Could anyone please help explain why it seems to appear when running but not when stepped through and help me to get rid of the error when the button is pressed?
Thanks in advance,
I have quite a bizarre error occurring with the code below - when the button is pressed to run this code I get the Run time error 1004 - Paste special method of range class failed. However if I step through the code no error occurs.
The error is occurring at the "paste special" stage of the code.
Could anyone please help explain why it seems to appear when running but not when stepped through and help me to get rid of the error when the button is pressed?
Thanks in advance,
Code:
Sub Remove_duplicates()'
' Remove_duplicates Macro
Sheets("Working").Visible = True
Application.GoTo Reference:="All_tbs"
Selection.Copy
Range("F4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Range("$F$4:$G$110145").Removeduplicates Columns:=Array(1, 2), _
Header:=xlNo
Application.GoTo Reference:="new_tb_codes"
Selection.Copy
Sheets("Input").Select
ActiveSheet.Unprotect
Range("B26").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Protect
Sheets("Working").Visible = False
End Sub