Microsoft Visual Basic Run-time Error 1004 Application-defined
Contents |
be down. Please try the request again. Your cache administrator is webmaster. Generated Thu, 20 Oct 2016 13:49:16 GMT by s_nt6 (squid/3.5.20)
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss
Application Defined Or Object Defined Error 32809
the workings and policies of this site About Us Learn more
Application Defined Or Object Defined Error Access
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack application defined or object defined error vba range Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping http://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-msoffice_custom/run-time-error-1004-application-defined-or-object/e9513ffe-0648-4112-93b2-d3ae286011a0 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 a new sheet on the first time it runs. Any more sheets that follow this template are http://stackoverflow.com/questions/20601805/vba-run-time-error-1004-application-defined-or-object-defined-error 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 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 i
object-defined error If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can http://www.vbforums.com/showthread.php?337624-Run-time-error-1004-Application-defined-or-object-defined-error post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 12 of 12 Thread: Run-time error '1004': Application-defined or object-defined error Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode May 5th, 2005,12:05 defined or PM #1 neilma View Profile View Forum Posts Thread Starter New Member Join Date May 2005 Posts 6 Run-time error '1004': Application-defined or object-defined error Hi, Another novice problem from me. I get this error message: Run-time error '1004': Application-defined or object-defined error This is the statement that is highlighted when the error comes up. ActiveCell.FormulaR1C1 = "=Average(R[6]C[-2]:R[myDatasecs+6]C[-2])" Here is the code defined or object block: Set currentCell = Range("Q11") For n = 1 To 10 currentCell.Value = myOscArray(n, 1) currentCell.Offset(0, 1).Value = myOscArray(n, 2) currentCell.Offset(0, 2).Formula = "=RC[-2]-RC[-1]" Set nextCell = currentCell.Offset(1, 0) Set currentCell = nextCell Next n Range("E6").Select ActiveCell.FormulaR1C1 = "=Average(R[6]C[-2]:R[myDatasecs+6]C[-2])" Range("F6").Select ActiveCell.FormulaR1C1 = "Mean Flow" Thanks in advance, Neil Reply With Quote May 5th, 2005,02:40 PM #2 VBAhack View Profile View Forum Posts Fanatic Member Join Date Dec 2004 Location Sector 000 Posts 609 Re: Run-time error '1004': Application-defined or object-defined error Suggestion - turn on the macro recorder (Tools->Macro->Record New Macro) and type in the formula you want in the cell. Stop the recorder and see what you get. Maybe you already did this....... VBAhack Reply With Quote May 6th, 2005,10:44 AM #3 neilma View Profile View Forum Posts Thread Starter New Member Join Date May 2005 Posts 6 Re: Run-time error '1004': Application-defined or object-defined error Yeah. I already did that. The problem is that the amount of data that is taken into the spreadsheet is of varying length. So, I can't use a set of pre-programmed cell identities. The macro needs to