Excel Macro 1004 Application-defined Or Object-defined Error
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 of this site About Us Learn more about Stack runtime error 1004 application defined or object defined error excel Overflow the company Business Learn more about hiring developers or posting ads with us excel vba application defined or object defined error 1004 Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a excel run time error 1004 application defined or object defined error 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 excel vba error 1004 application-defined or object-defined error 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 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,
Application-defined Or Object-defined Error Excel
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 Columns(6).ColumnWidth = 11 Columns(10).ColumnWidth = 9 Call FormatForA5Printing("Cable Cards", 71) End If But on the 2nd go, it fails entirely, with the Run Time Error 1004 'Application Defined or Object Defined Error'. I'd appreciate any help. excel vba excel-vba excel-2003 share|improve this question edited Dec 16 '13 at 7:43 sancho.s 3,90841746 a
ads with YouTube Red. Working... No thanks Try it free Find out whyClose VBA run-time error '1004' Application-defined or Object-defined error EverydayVBA SubscribeSubscribedUnsubscribe762762 Loading... Loading... Working... Add to Want to watch this again later?
Application Defined Or Object Defined Error 32809
Sign in to add this video to a playlist. Sign in Share More application defined or object defined error access Report Need to report the video? Sign in to report inappropriate content. Sign in Transcript Statistics 10,933 views 5 application-defined or object-defined error vb6 Like this video? Sign in to make your opinion count. Sign in 6 12 Don't like this video? Sign in to make your opinion count. Sign in 13 Loading... Loading... Transcript http://stackoverflow.com/questions/20601805/vba-run-time-error-1004-application-defined-or-object-defined-error The interactive transcript could not be loaded. Loading... Loading... Rating is available when the video has been rented. This feature is not available right now. Please try again later. Published on Jan 21, 2016The Excel VBA run-time error '1004' is a catch all error but most likely you will get one of the following errors which we review in this videoApplication-defined or https://www.youtube.com/watch?v=xFzQ74AahEI Object-defined error"Application-defined or Object-defined error"or"Method 'Range' of Object '_Global' failed"These are both errors caused by trying to reference a cell or range that doesn't exist. _Code_Sub Runtime1004()Cells(n, 1).SelectCells(10000,1).Selectn = Range("ZZZA1")End Sub-~-~~-~~~-~~-~-Please watch: "Excel VBA Request a Video" https://www.youtube.com/watch?v=NO7Ew...-~-~~-~~~-~~-~- Category Education License Standard YouTube License Show more Show less Loading... Advertisement Autoplay When autoplay is enabled, a suggested video will automatically play next. Up next Eliminate VBA Vlookup Errors - Excel VBA Tips - Error 1004 No More! - Duration: 16:03. ExcelVbaIsFun 14,134 views 16:03 Run Time Error 1004 Help in Excel VBA - Scott's Job Tracker - Duration: 21:58. ExcelVbaIsFun 7,333 views 21:58 Remove runtime error 1004 - Duration: 1:19. jack Methue 18,196 views 1:19 Excel VBA Introduction Part 19 - Error Handling (On Error, Resume, GoTo) - Duration: 34:58. WiseOwlTutorials 34,585 views 34:58 Excel VBA Data Analysis Error 1004: Cannot find atpvbaen.xlam - Duration: 4:03. Puk Notes 91 views 4:03 Transfer data from one Excel worksheet to another automatically - Duration: 17:20. Dinesh Kumar Takyar 745,811 views 17:20 VBA Run-time Error '91' Object-variable or With block variable not set - Duration: 4:24. EverydayVBA 11,243
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins https://msdn.microsoft.com/en-us/library/office/gg264310.aspx Changelog Microsoft Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Office VBA language reference Visual Basic http://www.mrexcel.com/forum/excel-questions/535814-how-fix-visual-basic-applications-runtime-error-1004-application-defined-object-defined-error.html language reference Error Messages Error Messages Application-defined or object-defined error Application-defined or object-defined error Application-defined or object-defined error #Else clause must be preceded by a matching #If #Else If, #Else, or #End defined or If must be preceded by a matching #If #ElseIf must be preceded by a matching #If or #ElseIf and followed by an #ElseIf, #Else, or #End If
Forums Excel Questions How to fix : vba runtime error 1004 application defined or object defined error Results 1 to 5 of 5 How to fix : vba runtime error 1004 application defined or object defined errorThis is a discussion on How to fix : vba runtime error 1004 application defined or object defined error within the Excel Questions forums, part of the Question Forums category; Hi, I have been working on a set of data in excel for the past few days now. I am ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Mar 14th, 2011,08:14 AM #1 crunchie New Member Join Date Mar 2011 Posts 8 How to fix : vba runtime error 1004 application defined or object defined error Hi, I have been working on a set of data in excel for the past few days now. I am using a custom filter to get the data i want and then paste that data into a new worksheet. It was working fine untill today and now i cannot even select a row of cells without the error turning up. Here is the code i am trying to use; Code: Sub RevisedResults() Sheets("Test_Formatting").Select Selection.AutoFilter Field:=4, Criteria1:="<>*car*", Operator:=xlAnd _ , Criteria2:="<>*plane*" Selection.AutoFilter Field:=5, Criteria1:="no" Range("A1").Select Columns("A").ColumnWidth = 20 Range("B1").Select Columns("B").ColumnWidth = 37 Range("C1").Select Columns("C").ColumnWidth = 20 Range("D1").Select Columns("D").ColumnWidth = 125 Range("E1").Select Columns("E").ColumnWidth = 13 Range("F1").Select Columns("F").ColumnWidth = 13 Range("G1").Select Columns("G").ColumnWidth = 13 Range("H1").Select Columns("H").ColumnWidth = 19 Range("I1").Select Columns("I").ColumnWidth = 15 Rows("2:2").Select Selection.Insert Shift:=xlDown Range("A2:I2").Select Range("A2:I2").Value = "'======" Range("A1:I1").Select Selection.AutoFilter I can execute the search no problem but once i try to exceute the code in bold above i.e. "Range("A1").Select" i get the "1004" error. I have tried closing and opening excel but this hasnt worked. I have been copying and pasting this data a few times so that might be part of the problem. The data i am trying to use is roughly 150 rows in size. Any help would be greatly appreciated. Regards, Crunchie End Sub Share Share this post on Digg Del.icio.us Technorati Twitter Reply With Quote Mar 14th, 2011,11:50 AM #2 Von Pookie MrExcel MVP Join Date Feb