简体   繁体   English

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

[英]Run-time Error 1004 Application defined and object error

I have a problem with error 1004. Bug is somewhere in use of Paste function, but I do not know where. 我遇到错误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

Thanks for your answers. 感谢您的回答。

Problem is in Clear function. 问题在于清除功能。 This is a solve: 这是一个解决方案:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行时错误“1004”:应用程序定义或 Object 定义错误 - Run-time error '1004': Application Defined or Object Defined Error 运行时错误 1004:应用程序定义或 object 定义错误 - Run-time error 1004: application defined or object defined error Excel错误1004-运行时错误&#39;1004&#39;应用程序定义或对象定义的错误 - Excel Error 1004 - Run-time error '1004' Application-defined or object-defined error 错误运行时错误“ 1004”:应用程序定义或对象定义的错误 - Error Run-time error '1004': application-defined or object-defined error 添加列会出现错误运行时错误“1004”应用程序定义或对象定义错误 - Adding columns gives error Run-time error '1004' Application-defined or object-defined error FomulaArray导致运行时错误1004应用程序定义的错误或对象定义的错误 - FomulaArray causes Run-time error 1004 Application-defined or object-defined error Excel宏中的运行时错误1004:应用程序定义或对象定义的错误 - Run-time error 1004 in Excel macro: Application-defined or object-defined error Excel VBA中的“运行时错误&#39;1004&#39;:应用程序定义的错误或对象定义的错误” - “Run-time error '1004': Application-defined or object-defined error” with ranges in Excel VBA 应用程序定义或对象定义的运行时错误&#39;1004&#39;错误VBA代码 - run-time error '1004' application-defined or object-defined error VBA code VBA运行时错误1004:应用程序定义或对象定义的错误 - VBA Run-time error 1004: Application-defined or object-defined error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM