Thread: Loop
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Loop

Try:

Sub wanna()
Dim r As Range, i As Long
i = Range("c" & Rows.Count).End(xlUp).Row
Set r = Cells(i + 1, "c")
For j = 1 To i
v = Cells(j, "c").Value
If v = "FAX" Or v = "GFX" Or v = "PH" Or v = "TOT" Then
Else
Set r = Union(r, Cells(j, "c"))
End If
Next
r.EntireRow.Delete
End Sub

--
Gary's Student
gsnu200703


"Wanna Learn" wrote:


Hello
On a daily basis I import 4 columns of data , the total number of rows is
different everyday. On column C I need to delete the rows that do not
contain the words , FAX, GFX, PH, TOT . Is there a macro for this ? As
always Thanks