Error 1004 Application Defined Or Object Defined Error Vba
Contents |
here for a quick overview of the site Help Center Detailed answers to any run time error 1004 application defined or object defined error excel vba questions you might have Meta Discuss the workings and policies runtime error 1004 application defined or object defined error of this site About Us Learn more about Stack Overflow the company Business Learn more about application-defined or object-defined error excel hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow application-defined or object-defined error vb6 is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up VBA - Run Time Error 1004 'Application Defined or Object Defined Error' up vote 2 down vote favorite 1 I have an excel document that copies a template sheet into
Application Defined Or Object Defined Error 32809
a new sheet on the first time it runs. Any more sheets that follow this template are appended to the newly created sheet. I'm getting the error in the title in this section of code: If Worksheets("User Configuration").Cells(9, 15).Value = 1 Then Worksheets("Cable Cards Template").Range("A1:J33").Copy With Worksheets("Cable Cards") **.Range(Cells(RangeStartRow, RangeStartColumn), Cells(RangeEndRow, RangeEndColumn)).PasteSpecial xlValues** .Range(Cells(RangeStartRow, RangeStartColumn), Cells(RangeEndRow, RangeEndColumn)).PasteSpecial xlFormats End With Worksheets("Cable Cards Template").Shapes("Picture 1").Copy Worksheets("Cable Cards").Paste Cells(RangeStartRow, RangeStartColumn) Call Sheets.FormatCableCardRows End If Basically if the IF statement is true (the cell = 1), then a range on a particular sheet should be copied and pasted into the new sheet at the range given using pastespecial for values and formatting. Following that, the "newly created" sheet should have an image copied into the top left cell of the template and then a subroutine is called to format the rows of the new sheet. I'm getting the error at the first .Range call after the wit
be down. Please try the request again. Your cache administrator is webmaster. Generated Mon, 10 Oct 2016 06:58:50 GMT by s_ac15 (squid/3.5.20)
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of http://superuser.com/questions/962403/getting-application-defined-or-object-defined-error-1004 this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Super User Questions Tags Users Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question defined or Anybody can answer The best answers are voted up and rise to the top Getting “Application Defined or Object Defined” error '1004" up vote 0 down vote favorite 1 So I was trying to copy data from different sheet and paste on current and I am getting this error: "Application Defined or Object Defined" error '1004" Can someone help me with this ? Option defined or object Explicit Sub finddata() Dim fname As String Dim FinalRow As Long Dim i As Integer Sheets("Report").Range("A10:N200").ClearContents fname = Sheets("Report").Range("A4").Value FinalRow = Sheets("Database").Range("A1000").End(xlUp).Row For i = 3 To FinalRow If Sheets("Database").Cells(i, 1) = fname Then Sheets("Database").Range(Cells(i, 11), Cells(i, 24)).Copy ----> Getting "Application Defined or Object Defined" error '1004" on this line Sheets("Report").Range("A1000").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats End If Next i End Sub microsoft-excel vba runtime-error share|improve this question edited Dec 6 '15 at 19:39 Hennes 50.9k776121 asked Aug 25 '15 at 9:42 Mr Miyagi 8117 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted The reference to Cells isn't on the same sheet as the call to Range. This is mentioned in the docs for Range.Item. It will will work if Database is the active sheet but not otherwise. Try replacing the error line with With Sheets("Database") .Range(.Cells(i, 11), .Cells(i, 24)).Copy End With Note the periods before Cells. share|improve this answer edited Aug 25 '15 at 10:02 answered Aug 25 '15 at 10:01 cxw 8471418 Can you troubleshoot and tell me the right solution ? –Mr Miyagi Aug 25 '15 at 10:01 Wh