Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 对于每个If语句对象定义的错误_Excel_Vba - Fatal编程技术网

Excel 对于每个If语句对象定义的错误

Excel 对于每个If语句对象定义的错误,excel,vba,Excel,Vba,我似乎在将每个循环的设置为。。。环Excel对我大叫“运行时错误'1004':应用程序定义或对象定义错误” 这个特定的工作表大约有58k行,我需要循环并移动到不同的工作表。我已经搜索了2个多小时,还没有找到解决方案。任何帮助都将不胜感激。你能试试这个吗 Sub killingme() Dim i As Integer, o As Integer i = 2 o = 2 For Each r In Worksheets("Stats").Rows If Cells(r.Row, 5).

我似乎在将每个循环的
设置为。。。环Excel对我大叫“运行时错误'1004':应用程序定义或对象定义错误”

这个特定的工作表大约有58k行,我需要循环并移动到不同的工作表。我已经搜索了2个多小时,还没有找到解决方案。任何帮助都将不胜感激。

你能试试这个吗

Sub killingme()
Dim i As Integer, o As Integer

i = 2
o = 2

For Each r In Worksheets("Stats").Rows
    If Cells(r.Row, 5).Value = 9386 And Cells(r.Row, 6) = 3486 Then
        r.EntireRow.Copy
        Sheets("Sheet2").Rows(o & ":" & o).PasteSpecial (xlPasteValues)
        r.EntireRow.Delete
        o = o + 1
        Stop
    End If
    i = i + 1
Next

End Sub

先生,你是个天才。非常感谢。
Sub killingme()
Dim i As Integer, o As Integer

i = 2
o = 2

For Each r In Worksheets("Stats").Rows
    If Cells(r.Row, 5).Value = 9386 And Cells(r.Row, 6) = 3486 Then
        r.EntireRow.Copy
        Sheets("Sheet2").Rows(o & ":" & o).PasteSpecial (xlPasteValues)
        r.EntireRow.Delete
        o = o + 1
        Stop
    End If
    i = i + 1
Next

End Sub