Error message please help!

jon321

New Member
Joined
Oct 27, 2008
Messages
47
When this part of my code is used an error report comes up and the de-bugger highlights the pastespecial part. However when the protection is removed from the sheet it is pasting to also removing the "Unprotect" code it works fine??

the error message is....

Run-time error '1004'
Paste special method of range class failed

ActiveSheet.Unprotect password:="jon"

Range("A1000").End(xlUp).Select
Selection.Offset(1, 0).Select


Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False


Any Suggestions???
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Can you clarify this:
However when the protection is removed from the sheet it is pasting to also removing the "Unprotect" code it works fine??
?
 
Upvote 0
Yes there is definatly something on the clipboard to paste.. and to clarify it... if i remove the protection from the sheet that the code is running on.. it will paste onto it fine.
 
Upvote 0
Where's the bit of the code that initiates the copy? And are you abolsutely sure that the sheet is successfully unprotected?
 
Upvote 0
I think you will find that:

ActiveSheet.Unprotect password:="jon"

clears the clipboard. So try moving it before your copy statement.
 
Upvote 0
Put your Unprotect code before you "fill" the clipboard.
 
Upvote 0
Fantastic it was clearing the clipboard when unprotecting moved it around now its working fine !!! thanks Guys!
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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