|
| ||||||||||
| Tags: error 1004, excel |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Runtime Error 1004 in vba excel
I am trying to import data from an excel file to another using a macro. The problem is When I paste the values I get the following error: "This operation requires that the cells combine with the same size" (error 1004 runtime) The macro code is as follows, and the error is given by the line preceded by (*): Code: Workbooks.Open Filename: = "L: \ myFile.xls", _ UpdateLinks: = 0 Sheets ( "tab02). Select Range ( "A4: T47"). Select Selection.Copy Windows (MyFile2.xls). Activate Sheets ( "Files"). Select Range ( "A4"). Select Selection.PasteSpecial Paste: = xlFormats, Operation: = xlNone, SkipBlanks: = _ False, Transpose: = False (*) Selection.PasteSpecial Paste: = xlValues, Operation: = xlNone, SkipBlanks: = _ False, Transpose: = False Columns ( "A: A"). EntireColumn.AutoFit
__________________ Signatures reduce available bandwidth |
|
#2
| ||||
| ||||
| Re: Runtime Error 1004 in vba excel
You receive a "Runtime error 1004 , When you try to copy and to paste filtered data programmatically in a Microsoft Office Excel 2003 workbook, you receive one of the following error messages: See here for more helps http://support.microsoft.com/kb/905164 |
|
#3
| ||||
| ||||
| Re: Runtime Error 1004 in vba excel
Hello. Try the following code: Code: Workbooks.Open Filename: = "c: \ myFile.xls" UpdateLinks: = 0
Sheets ( "tab02). Select
Worksheets ( "tab02). Range (" A4: K49 "). Select
Selection.Copy
Windows (MyFile2.xls). Activate
Sheets ( "Files"). Select
Worksheets ( "Files"). Range ( "A4"). Select
Selection.PasteSpecial Paste: = xlFormats, Operation: = xlNone, SkipBlanks: = False, Transpose: = False
Selection.PasteSpecial Paste: = xlValues, Operation: = xlNone, SkipBlanks: = False, Transpose: = False
Columns ( "A: A"). EntireColumn.AutoFit Worksheets ( "tab02). Range (" A4: K49 "). Select Instead of: Range ( "A4: K49"). Select Although it has been selected the sheet where you want to take the information during the execution of the VBA does not recognize it. I hope this information serves you, but do not hesitate to ask again. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Runtime Error 1004 in vba excel" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Excel VBA Run-time error '1004' Paste method of Worksheet class failed | PatrickW | Windows Software | 1 | 14-03-2012 01:08 PM |
| Excel 2007 Macro runtime error '1004' | JRadimus | Windows Software | 1 | 13-01-2012 11:19 PM |
| Runtime error R6025 on Excel 2010 with Windows 7 | Maal-Gaadi | Windows Software | 5 | 05-10-2011 10:31 AM |
| Using Internet Explorer gives Microsoft Visual C++ Runtime Library Runtime Error | Abejar | Windows Software | 3 | 22-04-2009 11:02 PM |
| Microsoft Visual C++ Runtime Library Symantec Runtime error | Ranchero | Windows XP Support | 8 | 27-09-2008 09:08 AM |