1004 Application-defined Or Object-defined Error In Vba
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies run time error 1004 vba application defined or object defined of this site About Us Learn more about Stack Overflow the company
Runtime Error 1004 Application Defined Or Object Defined Error
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges runtime error 1004 application defined or object defined error excel Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: application-defined or object-defined error excel 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 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
Application-defined Or Object-defined Error Vb6
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 with worksheets("cable cards") statement. I've tried not using the with statement, copying values directly instead of paste-special etc. The weird thing is that this will run on the first go (when the new sheet is created via: If (RangeStartRow = 1) Then Worksheets.Add().Name = "Cable Cards" ' Create new sheet with given name only on first cable card Columns(1).ColumnWidth = 9.43 Colum
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 this site About Us Learn more about Stack Overflow the company Business application defined or object defined error 32809 Learn more about hiring developers or posting ads with us Super User Questions Tags Users application defined or object defined error access Badges Unanswered Ask Question _ Super User is a question and answer site for computer enthusiasts and power users. Join them; it only
Application Defined Or Object Defined Error Vba Range
takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Getting “Application Defined or Object Defined” error '1004" up vote http://stackoverflow.com/questions/20601805/vba-run-time-error-1004-application-defined-or-object-defined-error 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 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), http://superuser.com/questions/962403/getting-application-defined-or-object-defined-error-1004 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.7k775120 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 When I ran it first time it works perfectly second time it gives an error. –Mr Miyagi Aug 25 '15 at 10:02 Hey it worked perfectly thank you very much Sir. –Mr Miyagi Aug 25 '15 at 10:04 add a comment| You must log in to answer this question. Not the answer you're looking for? Browse other questions tagged microsoft-excel vba runtime-error . asked 1 year ago viewed 13423 times activ
be down. Please try the request again. Your cache administrator is webmaster. Generated Sun, 02 Oct 2016 16:07:18 GMT by s_hv1000 (squid/3.5.20)