VBA Deleting rows with the Like operator

前端 未结 3 1506
借酒劲吻你
借酒劲吻你 2020-12-12 06:17

Simple thing is not simple. I am trying to delete rows based on a specific column having data that begins with \"2L\". So I wrote this code (LastRow is understood):

3条回答
  •  时光取名叫无心
    2020-12-12 06:48

    I'll borrow from Jeeped here and offer an answer that doesn't require a loop:

    Sub DeleteBlankRows()
    
        With Worksheets(1)
            On Error Resume Next
            Intersect(.Range("F:F"), .UsedRange).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
            On Error GoTo 0
        End With
    
    End Sub
    

提交回复
热议问题