Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Hi there Can anyone help. I am looking for a macro or someway that I can delete data out of a workbook that dont contain specific data. If in column E it dont say one of the following Nhampton, euston, tring, bletchley, Nhamp Emd, Nhamp NJ, Nhamptn RS, Watford Jn, Bltchly MD, Bedford, Bletch CS or M keynes I need the row totally deleted. This will be all the way down the workbook until the last entry. Can anyone help. -- tweacle |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting a Row if it contains a specific word | Excel Discussion (Misc queries) | |||
Deleting rows with specific values | Excel Discussion (Misc queries) | |||
Deleting row with specific value | Excel Discussion (Misc queries) | |||
Deleting specific records | Excel Discussion (Misc queries) | |||
Deleting Specific Rows | Excel Discussion (Misc queries) |