Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row Deletion
I'd be most grateful if someone could offer some advice:
I need a macro which will delete all rows with the exception of those containing the words: Normal WTC Run-on in Column C Many thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Row Deletion
Hi,
You weren't particularly clear what you wanted so this will delete all rows that don;t contain your text and retain those rows that contain the text with NOTHING ELSE in the cell. Right click your sheet tab, view code and paste this in and run it. Sub copyit() mycolumn = "c" 'Change to suit Dim MyRange, MyRange1 As Range LastRow = Cells(Rows.Count, mycolumn).End(xlUp).Row Set MyRange = Range(mycolumn & "1:" & mycolumn & LastRow) For Each c In MyRange If UCase(c.Value) < "NORMAL WTC RUN-ON" Then If MyRange1 Is Nothing Then Set MyRange1 = c.EntireRow Else Set MyRange1 = Union(MyRange1, c.EntireRow) End If End If Next If Not MyRange1 Is Nothing Then MyRange1.Delete End If End Sub Mike "SiH23" wrote: I'd be most grateful if someone could offer some advice: I need a macro which will delete all rows with the exception of those containing the words: Normal WTC Run-on in Column C Many thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
#Ref! after row deletion | Excel Discussion (Misc queries) | |||
name deletion | Excel Discussion (Misc queries) | |||
dup value deletion | Excel Programming | |||
Row Deletion | Excel Programming | |||
Detecting Row Deletion | Excel Programming |