Why my macro doesn't delete all the rows (VBA)

后端 未结 1 1379
你的背包
你的背包 2021-01-16 03:25

i have this macro it is supposed to delete all the cells that doesnt have a background set to them, but when I execute the macro if two or more contiguous cells doesnt have

相关标签:
1条回答
  • 2021-01-16 03:50
    Sub Macro1()
        Dim a As Range, x As Long
    
        Set a = Hoja1.Range("A1:A12")
    
        For x = a.cells.count to 1 Step -1
            with a.cells(x)
                if .Interior.ColorIndex = xlNone Then .EntireRow.Delete
            End With
        Next x
    End Sub
    
    0 讨论(0)
提交回复
热议问题