在Excel中将某些行复制到新工作表的公式

我正在寻找一个公式,将根据一定的标准(特别是,该行是否突出显示)将行从一张纸复制到另一张纸。 怎么会这样做?

我结束了使用VBA。 我不得不在开始时使用“是/否”单元格来指定是否突出显示一行,以便每当有人更改值时都会自动更新。

Sub Autosort() Application.ScreenUpdating = False Sheets(2).Select Range(Cells(2, 1), Cells(Rows.Count, Columns.Count)).Clear Sheets(3).Select Range(Cells(2, 1), Cells(Rows.Count, Columns.Count)).Clear Sheets(1).Select FinalColumn = Cells(1, 1).End(xlToRight).Column FinalRow = 1 For x = 1 To FinalColumn thisRow = Cells(Rows.Count, x).End(xlUp).Row If thisRow > FinalRow Then FinalRow = thisRow End If Next x For x = 2 To FinalRow IsCompleted = Cells(x, 1).ValueThen If IsCompleted = "Yes" Then Cells(x, 1).Resize(1, FinalColumn).Interior.ColorIndex = xlColorIndexNone Cells(x, 1).Resize(1, FinalColumn).Copy Sheets(2).Select NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(NextRow, 1).Select ActiveSheet.Paste Sheets(1).Select ElseIf IsCompleted = "No" Then Cells(x, 1).Resize(1, FinalColumn).Interior.ColorIndex = 6 Cells(x, 1).Resize(1, FinalColumn).Copy Sheets(3).Select NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(NextRow, 1).Select ActiveSheet.Paste Sheets(1).Select Else Cells(x, 1).Value = "No" Cells(x, 1).Resize(1, FinalColumn).Interior.ColorIndex = 6 Cells(x, 1).Resize(1, FinalColumn).Copy Sheets(3).Select NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(NextRow, 1).Select ActiveSheet.Paste Sheets(1).Select End If Next x Application.CutCopyMode = False Application.ScreenUpdating = True End Sub