Share Button

error1004pastefailed
Runtime error means something missing. You can solve runtime error 1004 in excel from this article. Ms excel is the part of office and this application is used in offices and private sectors as database. You can use to store personal information in the excel. When you are working with excel worksheet and if you copy any worksheet and past it into another worksheet then you will receive runtime error 1004. You are not able to copy or move your excel sheet.

You will get an error message while copying or moving one sheet to another worksheet. The message is..

Run-time error ‘1004’: Copy Method of Worksheet Class failed

Run-time error ‘1004’: Application-defined or object-defined erro

  • The most common reason behind this error is installing incompatible or outdated driver, missing system files, corrupted registry file or damaged pc by viruses. Advanced System Repair Tool is the only solution for all the system errors. By installing this tool you will be able to remove above windows error.
    3 Steps to Fix this Error

    Step 1. Download Advance System Repair Tool [File Size: 15.7 MB]
    Step 2. SCAN your Windows PC
    Step 3. Click Fix button to Repair Error

Causes

If you are give the workbook a defined name and copy the excel sheet without saving and closing of the work book then this error will occurred. That means if the file will not saved then it gives runtime error because this is not saved in your computer and it miss when it is called. If you are an advance user then you can see this error in following code.

Sub CopySheetTest()
Dim iTemp As Integer
Dim oBook As Workbook
Dim iCounter As Integer

‘ Create a new blank workbook:
iTemp = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Set oBook = Application.Workbooks.Add
Application.SheetsInNewWorkbook = iTemp

‘ Add a defined name to the workbook
‘ that RefersTo a range:
oBook.Names.Add Name:=”tempRange”, _
RefersTo:=”=Sheet1!$A$1″

‘ Save the workbook:
oBook.SaveAs “c:\test2.xls”

‘ Copy the sheet in a loop. Eventually,
‘ you get error 1004: Copy Method of
‘ Worksheet class failed.
For iCounter = 1 To 275
oBook.Worksheets(1).Copy After:=oBook.Worksheets(1)
Next
End Sub

Solution of runtime error 1004

As we know that excel is used in offices so Fixing of runtime error code 1004 in excel is very necessary. To solve this error first of all save the workbook file from where you are copying excel sheet and then close it. Reopen the file and try again copy. You will see the difference between the above and here given code.

  • The most common reason behind this error is installing incompatible or outdated driver, missing system files, corrupted registry file or damaged pc by viruses. Advanced System Repair Tool is the only solution for all the system errors. By installing this tool you will be able to remove above windows error.
    3 Steps to Fix this Error

    Step 1. Download Advance System Repair Tool [File Size: 15.7 MB]
    Step 2. SCAN your Windows PC
    Step 3. Click Fix button to Repair Error

Sub CopySheetTest()
Dim iTemp As Integer
Dim oBook As Workbook
Dim iCounter As Integer

‘ Create a new blank workbook:
iTemp = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Set oBook = Application.Workbooks.Add
Application.SheetsInNewWorkbook = iTemp

‘ Add a defined name to the workbook
‘ that RefersTo a range:
oBook.Names.Add Name:=”tempRange”, _
RefersTo:=”=Sheet1!$A$1″

‘ Save the workbook:
oBook.SaveAs “c:\test2.xls”

‘ Copy the sheet in a loop. Eventually,
‘ you get error 1004: Copy Method of
‘ Worksheet class failed.
For iCounter = 1 To 275
oBook.Worksheets(1).Copy After:=oBook.Worksheets(1)
‘Uncomment this code for the workaround:
‘Save, close, and reopen after every 100 iterations:
If iCounter Mod 100 = 0 Then
oBook.Close SaveChanges:=True
Set oBook = Nothing
Set oBook = Application.Workbooks.Open(“c:\test2.xls”)
End If
Next
End Sub

Everybody can not able to understand this program so they can simply copy the excel sheet after saving the workbook. I think runtime error 1004 will be removed from your computer. If this error will not removed from your computer then use these steps.

  1. Open excel and create a new workbook. Delete all the sheets from this workbook except one.
  2. Format the workbook after that add any text data and charts.
  3. Then click the Microsoft office button and then save as.
  4. Give the file name as you want. Change the save type save it as template (*.xlt) type and then click on save.
  5. If you want to insert template programmatically then use the following code.

Sheets.Add Type:=path\filename

This process work successfully and fix runtime error 1004 of excel.

Share Button
Solve Runtime Error Code 1004 on Windows 10/8/7, XP, Vista

Leave a Reply

Your email address will not be published. Required fields are marked *