运行时错误 1004 应用程序定义和对象错误

阿尔夫.cz

我遇到了错误 1004 的问题。错误是在使用粘贴功能的某个地方,但我不知道在哪里。

For i = 0 To citac
If pole(i + 1) - pole(i) > 1 Then
thissheet.Range("E" & CStr(pole(i) + 1) & ":E" & CStr(pole(i + 1))).Copy
Else
thissheet.Range("E" & CStr(pole(i) + 1)).Copy
End If

    For j = 2 To thiswbk.Worksheets.Count
    thiswbk.Sheets(j).Range("A1:A100000").Clear

    If pole(i + 1) - pole(i) > 1 Then

    thiswbk.Sheets(j).Range("A1:A" & CStr(pole(i + 1) - pole(i))).PasteSpecial xlPasteAll
    Else
    **thiswbk.Sheets(j).Range("A1").PasteSpecial xlPasteAll**<-problem

    End If
    Next j

Next i

感谢您的回答。

阿尔夫.cz

问题在于清除功能。这是一个解决方案:

For j = 2 To thiswbk.Worksheets.Count
    thiswbk.Sheets(j).Range("A1:A100000").Clear
    Next j

For i = 0 To citac
If pole(i + 1) - pole(i) > 1 Then
thissheet.Range("E" & CStr(pole(i) + 1) & ":E" & CStr(pole(i + 1))).Copy
Else
thissheet.Range("E" & CStr(pole(i) + 1)).Copy
End If

    For j = 2 To thiswbk.Worksheets.Count

    If pole(i + 1) - pole(i) > 1 Then

    thiswbk.Worksheets(j).Range("A1:A" & CStr(pole(i + 1) - pole(i))).PasteSpecial xlPasteAll
    Else
    thiswbk.Worksheets(j).Range("A1").PasteSpecial xlPasteAll

    End If
    Next j

Next i

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

运行时错误'1004'应用程序定义的错误或对象定义的错误'

运行时错误'1004':应用程序定义的错误或对象定义的错误VBA

范围的VBA运行时错误1004“应用程序定义的错误或对象定义的错误”

运行时错误'1004'

运行时错误 1004 应用程序定义或对象定义错误

运行时错误 1004 设置公式属性时应用程序定义或对象定义的错误

Excel超链接宏错误运行时1004应用程序定义或对象定义的错误

Excel-运行时错误1004“应用程序定义或对象定义的错误”

Excel 宏中的运行时错误 1004:应用程序定义或对象定义错误

VBA INDEX MATCH 运行时错误“1004”:应用程序定义或对象定义错误

Excell VBA 运行时错误“1004”:应用程序定义或对象定义错误

运行时错误'1004'应用程序定义或对象定义的错误

VBA运行时错误1004:应用程序定义或对象定义的错误

运行时错误 1004 - 应用程序定义或对象定义错误

Excel VBA运行时错误1004“应用程序定义或对象定义的错误”

运行时错误“1004”:应用程序定义或对象定义的错误 .Cells

运行时错误 1004:应用程序定义或对象定义错误

应用程序和对象定义的运行时错误1004-使用for循环填充单元格(x,y)

错误:-运行时错误'1004'

运行时错误'1004':重复使用“范围”对象的应用程序定义或对象定义的错误

运行时错误1004和424

VBA Excel。运行时错误'1004'。应用程序定义或操作定义的错误

VBA 数据透视表过滤器运行时错误“1004”:应用程序定义或对象定义错误

引用范围:运行时错误“1004”对象定义错误

FormulaArray产生运行时1004错误

Excel VBA运行时错误1004

运行时错误1004-vlookup

VBA - 运行时错误“1004”

编译错误:语法错误或运行时错误“1004”:应用程序定义或对象定义的错误“Last Row and CountIF”