Este sub-item exclui a (s) linha (s) inteira (s) de uma planilha quando um valor definido pela variável thestring está na coluna definida pela variável thecolumn
Sub deleterows()
Dim a As Application
Dim wkb As Workbook
Dim wks As Worksheet
Dim DataRange As Range
Set a = Application
Set wkb = ThisWorkbook
Set wks = wkb.ActiveSheet
wks.Application.ScreenUpdating = False
thecolumn = 2 'this have to be changed to the desired column
thestring = "some text" ' this have to be changed too
reviewing = True
visitrow = 1
While reviewing = True
visitrow = visitrow + 1
If wks.Cells(visitrow, 1) = "" Then
reviewing = False
End If
celldata = wks.Cells(visitrow, thecolumn)
If IsNumeric(celldata) = True Then
celldata = Trim(Str(celldata))
End If
If celldata = thestring Then
wks.Rows(visitrow).Delete
visitrow = visitrow - 1
End If
Wend
wks.Application.ScreenUpdating = True
Message = MsgBox("Finished!", vbOKOnly)
End Sub