Paste Method of Worksheet Class Failed - Plz Help

UMAKEMESIK

Active Member
Joined
Oct 3, 2005
Messages
378
I have this simple copy and paste code from one workseet to another in the same workbook.

I get the runtime 1004 error on the activesheet. paste line

any help would be appreciated.



Code:
Sheets("numberlog").Range("a1").Copy
Sheets("sheet1").Range("ab3").Select

ActiveSheet.Paste
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try it as a one liner

Sheets("numberlog").Range("a1").Copy Destination:= Sheets("sheet1").Range("ab3")
 
Upvote 0
Thanks for taking the time.

I tried that and get the same error.

but this time when i click "End" on the error dialog box it actually paste the number there.

so it appeard to work but i had to click through the error dialog box for it to work.
 
Upvote 0
What is the TEXT of the error message?

Are there any merged cells intersecting the referenced cells on either sheet?
 
Upvote 0
Thanks for your time.

There are no intersecting merged cells. The text of the error dialog box is:

"run-time error 1004

Paste Method of Worksheet class failed.

here is the code

Code:
Sub Macro1()


Application.ScreenUpdating = False



Sheets("SHEET2").Range("a1").Copy


Sheets("sheet1").Range("aB22").Select

ActiveSheet.Unprotect "dod"

ActiveSheet.Paste
    'ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
        'DisplayAsIcon:=False
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        True
   

ActiveWorkbook.Save
 
 
 Application.ScreenUpdating = True
 
 
End Sub

The sheet ends at "Activesheet.paste" with the error.

The funny this is that I set up the same code on another blank excel workbook and by itself it works on this new workbook. Now when I try to use it on my completed form it does not work. My completed from runs many macros and does a lot of things so maybe i am missing some other area that it's trying to access or there is a conflict.

Question: Is there another way to write this copy and past command so i will not get this error?

Thanks again.
 
Upvote 0
Well, you can start by Not Selecting the Sheet, and Not relying on ActiveSheet.
You should always specify the sheet explicitly..

Try
Code:
With Sheets("Sheet1")
    .Unprotect "dod"
    Sheets("SHEET2").Range("a1").Copy Destination:= .Range("AB22")
    .Protect "dod"
End With
 
Upvote 0
Wow that was simple.

Thanks again for taking the time.

I have configured that into my sheet and it works like a charm!!!!!

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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