VBA 删除有颜色的行

Dim lecNum As Integer
    Dim lecturelastRow As Integer
    lecturelastRow = ActiveWorkbook.Sheets("sheeet1").UsedRange.Rows.Count
    For lecNum = 0 To lecturelastRow

        '将第二列是红色的行删除
        If Cells(lecNum, 2).Interior.ColorIndex = 3 Then
           Rows(lecNum).Delete shift:=xlUp
           Exit For
        End If
    Next

猜你喜欢

转载自fengyilin.iteye.com/blog/2341389
vba