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

你可能感兴趣的:(vba)