PDA

View Full Version : Delete Row A if Row B Contains



justdream
09-03-2015, 11:01 AM
Dear Experts,

Could you kindly advice how to Delete Row A if Row B doesn't Contain: THERADIUS 0
Below is an example of input and output

Thanks in advance
14302

mperrah
09-03-2015, 03:51 PM
Sub delRowAif()

' this just checks range("B1)
If Cells(2, 1).Value <> "THERADIUS 0" Then
Rows(1).EntireRow.Delete
End If


End Sub

Aussiebear
09-03-2015, 05:37 PM
Try the following

Private DeleteRow()
For Each cel In Rng.Rows(2).Cells
If cel.Value <> "THERADIUS 0" Then
Rows(1).EntireRow.Delete
End If
Next cel
End Sub

salim ali
09-03-2015, 08:19 PM
USE THIS CODE


Sub Del_Row()
Set myrange = Rows(2).Cells
If Application.CountIf(myrange, "THERADIUS 0") Then Rows(1).EntireRow.Delete
End Sub