Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 For 循环删除整行,该循环检查该行的两列中的值是否小于一个数字。这就是我在下面得到的。
For Each row In Sheet4.Range("A6:AJ500").Cells If Columns("G").value < 500 And Columns("J").value < 50 _ Then row.EntireRow.Delete Next
您需要向后循环:
Sub foo() For i = 500 To 6 Step -1 If Cells(i, "G") < 500 and Cells(i, "J") < 50 Then Rows(i).Delete End If Next i End Sub