Z
Zak
I have the following code to do 3 things, when i ran the macro it deleted
just the one thing, then i pressed run again then it did the other thing! it
seemed i had to press run 3 times before the macro executed everything. cant
the macro do them all at once or with just one click?
thanks alot.
Sub Delete_Rows()
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("I:I"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Text) = "Covansys" _
Or (cell.Text) = "AMS" _
Or (cell.Text) = "Apollo" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.delete
End Sub
just the one thing, then i pressed run again then it did the other thing! it
seemed i had to press run 3 times before the macro executed everything. cant
the macro do them all at once or with just one click?
thanks alot.
Sub Delete_Rows()
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("I:I"), ActiveSheet.UsedRange)
For Each cell In rng
If (cell.Text) = "Covansys" _
Or (cell.Text) = "AMS" _
Or (cell.Text) = "Apollo" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.delete
End Sub