[英]Runtime error 1004 Microsoft excel cannot paste the data in excel vba
I have two excel sheets. 我有两个Excel工作表。
xlVlookupSheet
is one sheet name and xlShtCmdb
is another sheet from where it copying the columns data. xlVlookupSheet
是一个工作表名称,而xlShtCmdb
是从中复制列数据的另一个工作表。
I am getting the following error:- 我收到以下错误:
Runtime error 1004 Microsoft excel cannot paste the data-
It is coming in the second iteration of the below for loop
. 它在下面的
for loop
的第二次迭代中出现。 addressCols
is an array which contains the column names to be copied. addressCols
是一个数组,其中包含要复制的列名。
For index = UBound(addressCols) To 0 Step -1
xlVlookupSheet.Columns("A:A").Insert xlToLeft
xlShtCmdb.Columns(addressCols(index) & ":" & addressCols(index)).Copy
xlVlookupSheet.Activate
xlVlookupSheet.Select
xlVlookupSheet.Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues
Next
The problem is that , from where I was copying that excel sheet contains 33767 styles . 问题是,从我要复制的Excel工作表中包含33767个样式。 it will not copy from source to destination if the styles will be more than 3000. Hence i removed the styles and made the simple normal sheet and it worked.
如果样式将超过3000,它将不会从源复制到目标。因此,我删除了样式并制作了简单的普通纸即可。
you can get the number of active workbook styles by below code:- 您可以通过以下代码获取活动工作簿样式的数量:-
activeworkbook.styles.count activeworkbook.styles.count
For more information one can go below link:- 欲了解更多信息,请点击以下链接:
http://www.think-cell.com/en/support/kb/0156.shtml http://www.think-cell.com/en/support/kb/0156.shtml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.