Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
#Ref! after row deletion Rick Excel Discussion (Misc queries) 3 March 19th 10 04:39 PM
name deletion rk0909 Excel Discussion (Misc queries) 2 January 4th 08 11:03 PM
dup value deletion italiavb Excel Programming 0 February 6th 07 01:14 AM
Row Deletion Dan Excel Programming 3 September 1st 04 10:40 PM
Detecting Row Deletion GaryZ Excel Programming 0 July 6th 04 06:33 PM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"