VBA delete rows

前端 未结 2 2001
天涯浪人
天涯浪人 2020-12-12 04:55

I am trying to write a VBA code for excel that deletes rows based on the contents of certain cells (all in the same column). My program right now looks like this:

         


        
2条回答
  •  一生所求
    2020-12-12 05:30

    Sub removeCol()
        Dim i As Integer
    
        For i = 10 To 1 Step -1
            If Cells(i, 2) = "a" Then
                Rows(i).Delete
            End If
        Next
    End Sub
    

提交回复
热议问题