Excel Vba Copy Worksheet Run-time Error 1004
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 vba copy sheet error 1004 site About Us Learn more about Stack Overflow the company Business Learn more excel vba runtime error 1004 select method of worksheet class failed about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x excel vba runtime error 1004 paste method of worksheet class failed 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: Sign up runtime error excel vba runtime error 1004 application-defined or object-defined error 1004 cant copy sheet from source to dest up vote 5 down vote favorite Really this is curious. Let me try to explain what is going on. I wrote a macro in word that is calling a macro of an excelfile Set excel = CreateObject("excel.application") excel.Visible = True excel.workbooks.Open FileName:=tablePath IDcolumn = excel.Application.Run("main", generatedExelPath) the "main" function being called from the word macro is
Excel Vba Runtime Error 1004 Method Range Of Object _global Failed
"simply" generating a new excel-file by copying specific data from the called excel file. So we got 1 word and 2 excel documents. some sheets of excel1 have to be copied to excel2. therefore I use: For i = 0 To UBound(copySheets) Windows(srcWinName).Activate Sheets(copySheets(i)).Activate Set AcSh = ActiveSheet Windows(destWinName).Activate If copySheets(i) = "config" Then AcSh.Copy Before:=Sheets(1) Else AcSh.Copy After:=ActiveSheet End If Next i where copySheets contains the sheets that needs to be copied. But the copy commands throws an error. Something like "can't copy from source to destination cause the destination has less rows and columns than the source file" Atm excel1 is an xlsm as it was an xls file this error didn't occur. I wonder if this line, which adds the excel2 is the prob Workbooks.Add Template:="Workbook" maybe i should use another template but I don't know which one. If i create an empty xlsm file, save it and then use open this empty xlsm instead of the command before the error doesn't occur. Hope someone can help me. Ahh and one thing I should mention is: if I run the excel macro as above from the word m
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code Every Time | Build Automated Trading Models In
Excel Vba Runtime Error 1004 Method Saveas Of Object _workbook Failed
Excel | Excel Web Pages | Excel Video Training Forum New Posts FAQ excel vba runtime error 1004 autofilter method of range class failed Calendar Forum Actions Mark Forums Read Quick Links Today's Posts What's New? Advanced Search Forum HELP FORUMS Excel General Run excel vba runtime error 1004 pastespecial method of range class failed Time Error 1004 Copy method of Worksheet class failed in excel 2010 Excel Training / Excel Dashboards Reports If this is your first visit, be sure to check out the FAQ by clicking the http://stackoverflow.com/questions/12155471/runtime-error-1004-cant-copy-sheet-from-source-to-dest link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above. Click here to view the relaunched Ozgrid newsletter. Results 1 to 4 of 4 Thread: Run Time Error 1004 http://www.ozgrid.com/forum/showthread.php?t=194386 Copy method of Worksheet class failed in excel 2010 Thread Tools Show Printable Version Search Thread Advanced Search April 25th, 2015 #1 Karen337 View Profile View Forum Posts I agreed to these rules Join Date 6th October 2007 Posts 7 Run Time Error 1004 Copy method of Worksheet class failed in excel 2010 Hi everyone, This is driving me crazy. All I find is old data which didn't help. I am copying one worksheet from one workbook into another workbook. I am not making multiple copies, just one. I am using Excel 2010. I keep getting a Run Time Error 1004 Copy method of Worksheet class failed. I have used this code with the workbook name and the complete path but neither worked. I have confirmed that all variables below have the correct values. VB: Workbooks(FromWbk.Name).Sheets(FromWs).Copy _ After:=Workbooks(ToWbk.Name).Sheets.Count I would appreciate any help you could give me. Thanks Thanks in Advance. Karen337 Reply With Quote April 25th, 2015 #2 jindon View Profile View Forum Posts Excel Samurai Join Date 19th July 2004 Location Tokyo, Japan Posts 9,423 Re: Run Time Error 1004 Copy method of Worksheet class failed in excel 2010 Try something like VB: With Workbooks(FromWbk.Name) .Sheets(FromWs).Copy After:= .Sheets(.S
Forums Excel Questions Run time Error 1004: Copy method of Worksheet Class failed Results 1 to 5 of 5 Run time Error 1004: Copy method of Worksheet Class failedThis is a discussion on Run time Error 1004: http://www.mrexcel.com/forum/excel-questions/4817-run-time-error-1004-copy-method-worksheet-class-failed.html Copy method of Worksheet Class failed within the Excel Questions forums, part of the Question Forums category; I keep getting this error when creating a number of copies of a worksheet. I have tried: turning off http://www.vbforums.com/showthread.php?295812-Excel-VB-Run-Time-Error-1004-RESOLVED the ... 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 error 1004 Mode Apr 12th, 2002,01:44 AM #1 TREY New Member Join Date Apr 2002 Posts 3 I keep getting this error when creating a number of copies of a worksheet. I have tried: turning off the AutoCalculation, Copying a less complex worksheet, Insterting Do events - And have had now success. I was wondering would inserting a timer to slow down the copying help. Any help would be appreciated. Share Share this post on excel vba runtime Digg Del.icio.us Technorati Twitter Reply With Quote Apr 12th, 2002,01:51 AM #2 Ivan F Moala MrExcel MVP Join Date Feb 2002 Location Auckland, New Zealand Posts 4,209 On 2002-04-12 01:44, TREY wrote: I keep getting this error when creating a number of copies of a worksheet. I have tried: turning off the AutoCalculation, Copying a less complex worksheet, Insterting Do events - And have had now success. I was wondering would inserting a timer to slow down the copying help. Any help would be appreciated. Hi Trey Just a couple of Q's 1) What version of Excel 2) How are you calling the routine eg commandbutton, 3) What code are you using Share Share this post on Digg Del.icio.us Technorati Twitter Kind Regards, Ivan F Moala From the City of Sails Reply With Quote Apr 12th, 2002,04:42 AM #3 TREY New Member Join Date Apr 2002 Posts 3 Thanks for replying: (1) I am using Excel 97 but the same problem appears in Excel 2000 (2)I am using a command button in another sheet to start the procedure which: Deletes all worksheets in the file except for a specific 3. Then it creates the same number of copies of a timekeeping worksheets as names that have been entered in a particular range. It names each
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 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 26 of 26 Thread: Excel VB Run Time Error 1004 - RESOLVED Tweet Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jul 1st, 2004,08:55 AM #1 Helene View Profile View Forum Posts Thread Starter New Member Join Date Jul 2004 Location New York Posts 15 Excel VB Run Time Error 1004 - RESOLVED Good morning. I have a ? regarding a run time error (1004) in VB for Excel. I have a macro that runs fine through Alt F8. I created a control button and attached the macro. When I use the control button I get run time error 1004 with the message that says "Select method of range class failed." I am new at VB and any suggestions would be greatly appreciated. Thanks in advance for your assistance. -Helene Last edited by Helene; Jul 6th, 2004 at 07:32 AM. Reply With Quote Jul 1st, 2004,09:02 AM #2 DaveBo View Profile View Forum Posts Hyperactive Member Join Date Apr 2001 Location N42 29.340 W71 53.215 Posts 422 FWIW I don't know if this is any help, but I had a similar problem and this is the note I made to myself relative to that: Note, doing a WorkBooks…Add after a .Copy apparently clears out the paste buffer, i.e. the copied data is lost, so attempting a PasteSpecial fails since the buffer is now empty. Solution: do the .Copy after the .Add When doing a .Copy / .PasteSpecial, avoid doing anything in between. "The wise man doesn't know all the answers, but he knows where to find them." VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15 Reply With Quote Jul 1st, 2004,09:07 AM #3 Helene View Profile View Forum Posts Thread Starter New Member Join Date Jul 2004 Location New York Posts 15 Thank you for your help Dave. I'll le tyou know how it works out. Have a great day. -Helene Reply With Quote Jul 1st, 2004,11:00 AM #4 Helene View Profile View Forum Posts Thread Starter New Member Join Date Jul 2004 Location New York Posts 15 Dave - I sent your suggestions down to the tech dept, and they couldn't help me. I sort of understand what you're saying, however I don't have any .Add in the macro. When I debug, it highlights Range("A101000").Select No one here seems to be able to help and I'm stuck. Any other suggestions? Thanks again. Enjoy the day. -Helene I don't know why the smile comes up in t