View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge[_4_] Nick Hodge[_4_] is offline
external usenet poster
 
Posts: 11
Default Once criteria has been met, delet the same row.

Les

The following will find the last row in column A and then, working upward.
Delete any rows in which the entry in column C starts with h or H

Sub deleterows()
Dim lLastRow As Long
Dim x As Long

lLastRow = Range("A65536").End(xlUp).Row
For x = lLastRow To 1 Step -1
If UCase(Left(Range("A" & x).Offset(0, 2).Value, 1)) = "H" Then
Range("A" & x).EntireRow.Delete
End If
Next x

End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS



Les Stout wrote:
Good day,

I am Looping down the first column of a spreadsheet and checking for a
certain bit of text in the 3rd column, when i loop downwards and i
find what i am looking for, i want to delete the entire row with the
data that has met my requirements, can anybody help me with some code?

I also have multiple criteria that i must look for, is it possible to
use wild cards?

Example:
I have 10 different combinations, all starting with "H"


Do Until ActiveCell = ""
If ActiveCell.Offset(0, 2) = ("HEP") Then

ElseIf ActiveCell.Offset(0, 2) = ("HEPA") Then

Les Stout

*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Les