Deleteing some repetative information

M

Manny

Hi

I have a word doc that imported into excel. I was able to rid myself of text that was not needed by useing the text to columns feature. All of my text appears in rows. In between ea "Beneficiary" and "____Trustor" contains text that I do not want. Is there a formula for keeping the range between "_____Trustor(owner)" and "_________Beneficiary______" for ea. name?
Ex
Row: ____TRUSTOR(OWNER)_MAILING_ADDRESS____ _________(TD) LOAN INFORMATION_________
Row: Ruth E. Parks DATE: 08/01/2002 DOC#: 2002-0180345
Row: 2056 W 68th St 90047 TD $: 156,000 DelqDate: 09/01/200
Row: Los Angeles, Ca. (323) 939-8515 Delq: 7,846 AsOf: 12/16/200

Row: _____________BENEFICIARY_____________

Row: ____TRUSTOR(OWNER)_MAILING_ADDRESS____ _________(TD) LOAN INFORMATION_________
Row: Eula S. Neal DATE: 03/08/2002 DOC#: 2002-0056304
Row: 347 W 124th St 90061 TD $: 237,000 DelqDate: 09/01/200
Row: Los Angeles, Ca. (323) 755-1077 Delq: 7,567 AsOf: 12/16/200

Row: _____________BENEFICIARY______________
 
K

Ken Wright

One way:-

Sub DelRowsBtwTxt()

Dim lrow As Long
Dim ColW As Long
Dim Del As Boolean

Application.ScreenUpdating = False

Str1 = "TRUSTOR"
Str2 = "BENEFICIARY"
Del = False

ColW = ActiveSheet.UsedRange.Column - 1 + _
ActiveSheet.UsedRange.Columns.Count

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count

For r = lrow To 1 Step -1
With Cells(r, 1).Resize(1, ColW)
Set s1 = .Find(Str1, LookIn:=xlValues)
If Not s1 Is Nothing Then
Del = True
End If
Set s2 = .Find(Str2, LookIn:=xlValues)
If Not s2 Is Nothing Then
Del = False
End If

If s1 Is Nothing And Del = True Then
.EntireRow.Delete
End If
End With
Next r
Application.ScreenUpdating = True

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
Seasons Greetings and Very Best wishes to all :)
----------------------------------------------------------------------------



Manny said:
Hi,

I have a word doc that imported into excel. I was able to rid myself of text
that was not needed by useing the text to columns feature. All of my text
appears in rows. In between ea "Beneficiary" and "____Trustor" contains text
that I do not want. Is there a formula for keeping the range between
"_____Trustor(owner)" and "_________Beneficiary______" for ea. name??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top