Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Save Excel rows that contain specific text

Hi,
I got this code at http://www.mvps.org/dmcritchie/excel/delempty.htm
It deletes the rows that contain the text ANN. What Im asking for is
the opposite. Can it be modified to save the rows that contain the
text ANN???????

Sub Find_ANN()
Dim rng As Range
Dim what As String
what = "ANN"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Save Excel rows that contain specific text


How about datafilterautofiltercopy elsewhere
--
Don Guillett
SalesAid Software

"azSuch" wrote in message
oups.com...
Hi,
I got this code at
http://www.mvps.org/dmcritchie/excel/delempty.htm
It deletes the rows that contain the text ANN. What Im asking for is
the opposite. Can it be modified to save the rows that contain the
text ANN???????

Sub Find_ANN()
Dim rng As Range
Dim what As String
what = "ANN"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Save Excel rows that contain specific text

Assume you data is in column A
Sub DeleteNonANN()
dim rng as Range, rng1 as Range
set rng = range(.cells(2,1),.cells(rows.count,1).End(xlup))
set rng1 = rng.offset(-1,0).Resize(rng.rows.count + 1,1)
rng1.AutoFilter Field:=1,
Criteria1:="<*ANN*"
rng2.specialcells(xlVisible).Entirerow.Delete
activesheet.AutoFilterMode = False
End sub

if the rows to keep should contain only the complete word ANN, then change
Criteria1:="<*ANN*"
to
Criteria1:="<ANN"

--
Regards,
Tom Ogilvy




"azSuch" wrote:

Hi,
I got this code at http://www.mvps.org/dmcritchie/excel/delempty.htm
It deletes the rows that contain the text ANN. What Im asking for is
the opposite. Can it be modified to save the rows that contain the
text ANN???????

Sub Find_ANN()
Dim rng As Range
Dim what As String
what = "ANN"
Do
Set rng = ActiveSheet.UsedRange.Find(what)
If rng Is Nothing Then
Exit Do
Else
Rows(rng.Row).Delete
End If
Loop
End Sub


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
Delete rows with specific text David New Users to Excel 5 April 3rd 23 07:29 PM
Delete Rows Without Specific Text waggett Excel Worksheet Functions 6 October 6th 09 11:34 AM
Importing Specific Rows from a text file into Excel rstroughair Excel Programming 1 October 22nd 06 11:54 PM
Delete Rows With Specific Text Sean Excel Programming 1 August 19th 06 03:47 PM
Delete rows with specific text MAYDAY[_3_] Excel Programming 8 June 7th 05 08:38 PM


All times are GMT +1. The time now is 06:07 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"