View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default for each c in range.. how set counter "minus 1"?

You don't say what tel is but
the trick is to work from the bottom up and you really don't want to check
the WHOLE column.

for i=cells(rows.count,"F").end(xlup).row to 2 step-1
if cells(i,"f")=tel then rows(i).delete
next i

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"mino" wrote in message
...
Hi.
In my code, I delete the entire row of a particolar cell 'c' (if tel = c).
However, the loop "next c" jump to next one, but the real new 'c' is in
the same row, because actual 'c' in same row is deleted.
How can set c counter minus 1?

[...]
For Each c In Range("F:F")
If tel = c Then
Rows((c.Row)).Delete
End If
End If
Next c
[...]

Thanks to all
M.