Delete entire row when a value exist in a second sheet

后端 未结 2 1148
孤独总比滥情好
孤独总比滥情好 2021-01-27 06:58

I have 2 sheets: sheet1 and sheet2. I have a value in cell A3 (sheet1) which is not constant. And many files in sheets2.

What I would like to do, is when the value in ce

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-27 07:25

    Sub Test()

    Dim ws As Worksheet

    For x = 1 To Rows.Count

    If ThisWorkbook.Sheets("Sheet2").Cells(x, 1).Value = ThisWorkbook.Sheets("Sheet1").Cells(3, 1).Value Then ThisWorkbook.Sheets("Sheet2").Cells(x, 1).EntireRow.Delete

    Next x

    End Sub

提交回复
热议问题