PasteSpecial method of Range class failed

Excelnewbie001

Board Regular
Joined
Jan 25, 2017
Messages
79
I used the macro recorder on a protected sheet to copy and paste and I am getting the following error if someone can please tell me how to get rid of it please....thanks for any help

Code:
Wb.Sheets("Test1").Range("F5:H5").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Test").Select
    Sheets("Test").Unprotect "Test12"
    Range("J2").Select
   [COLOR=#ff0000] Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False, Transpose:=False[/COLOR]
    Sheets("Test").Select
    Range("D2").Select
 
Last edited:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Assuming that you are trying to paste onto sheet Test try this mod
Code:
    [COLOR=#0000ff]Sheets("Test")[/COLOR].Range("J2").Select
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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