View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tweacle[_3_] tweacle[_3_] is offline
external usenet poster
 
Posts: 1
Default Need help in deleting specific data.


Dont know if anyone can help me on this.
Ive managed to get a macro but its deleting the wrong way round.


Sub TRY()
Dim c As Range
Dim x(), j, fo As String
Dim i As Integer
x = Array("Nhampton", "euston", "tring", "bletchley", "Nhamp Emd",
"Nhamp NJ", "Nhamptn RS", "Watford Jn", "Bltchly MD", "Bedford",
"Bletch CS", "M keynes")
For i = LBound(x) To UBound(x)
Set c = Range("E:E").Find(x(i), LookIn:=xlValues, Lookat:=xlWhole)
If c Is Nothing Then GoTo nxt
fo = c.Address
Do Until j = fo
Set c = Range("E:E").FindNext(After:=c)
j = c.Address
Range(j).EntireRow.ClearContents
Loop
nxt:
Next
Range("E:E").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

What im trying to do is where the data in column "E" says Northampton
etc as shown above I need to KEEP IT and not delete, but delete
everything else.
Just one other thing I forgot to mention was that if the cell is blank
in column E could the macro poss ignore this cell.

Thanks




--
tweacle