我想创建一个代码,以便如果在一张纸的B列的单元格中出现一个值(准确地说是一个单词),我希望将包含该单元格的行剪切并粘贴到另一张纸中。本质上,如果项目标记为已完成,则将它们删除到已完成的工作表中。到目前为止,这是根据我已阅读的内容整理而成的内容,但似乎仍然行不通。
Sub Move Completed()
Dim i As Variant
Dim endrow As Integer
Dim Tracker As Worksheet, Completed As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set Tracker = ActiveWorkbook.Sheets("US Requests")
Set Completed = ActiveWorkbook.Sheets("Completed Requests")
endrow = Tracker.Range("A" & Tracker.Rows.Count).End(xlUp).Row
For i = 2 To endrow
If Tracker.Cells(i, "I").Value = "Complete" Then
Tracker.Cells(i, "I").EntireRow.Cut Destination:=Completed.Range("A" & LS.Rows.Count).End(xlUp).Offset(1)
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
我不确定的一件事是Range命令的工作方式或End(x1up).Offset(1)的作用。
谢谢