Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Finding A string

Would anybody have a procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Finding A string

Do a DataFilterAutofilter and filter on "Composite", then delete the
visible rows.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Abilio" wrote in message
...
Would anybody have a procedure to find a specific word such as "Composite"

in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Finding A string

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Finding A string

You can give this a try...

Sub Test()
Call DeleteRows("Composite")

End Sub

Sub DeleteRows(ByVal DeleteString As String)
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngFirst As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Cells
Set rngFound = rngToSearch.Find(What:=DeleteString, LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Nothing was found to delete.", vbInformation, "Nothing Found"
Else
Set rngFirst = rngFound
Set rngFoundAll = rngFound.EntireRow
Do
Set rngFoundAll = Union(rngFound.EntireRow, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFirst.Address = rngFound.Address
rngFoundAll.Delete
End If
End Sub

--
HTH...

Jim Thomlinson


"Abilio" wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding A string

You could record a macro when you do it manually. It'll be very close to what
you want.

Or...
Option Explicit
Sub testme02()

Dim FoundCell As Range

Do

With Worksheets("Sheet1").Range("g1").EntireColumn
Set FoundCell = .Cells.Find(What:="composite", _
After:=.Cells(1), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

If FoundCell Is Nothing Then
Exit Do
Else
FoundCell.EntireRow.Delete
End If
Loop

End Sub




Abilio wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Finding A string

Thank you very much Jim!

"Jim Thomlinson" wrote:

You can give this a try...

Sub Test()
Call DeleteRows("Composite")

End Sub

Sub DeleteRows(ByVal DeleteString As String)
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngFirst As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Cells
Set rngFound = rngToSearch.Find(What:=DeleteString, LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Nothing was found to delete.", vbInformation, "Nothing Found"
Else
Set rngFirst = rngFound
Set rngFoundAll = rngFound.EntireRow
Do
Set rngFoundAll = Union(rngFound.EntireRow, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFirst.Address = rngFound.Address
rngFoundAll.Delete
End If
End Sub

--
HTH...

Jim Thomlinson


"Abilio" wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Finding A string

Jim, How could I adapt that to search for textbox 4's contents, and then
delete?

"Jim Thomlinson" wrote:

You can give this a try...

Sub Test()
Call DeleteRows("Composite")

End Sub

Sub DeleteRows(ByVal DeleteString As String)
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngFirst As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Cells
Set rngFound = rngToSearch.Find(What:=DeleteString, LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Nothing was found to delete.", vbInformation, "Nothing Found"
Else
Set rngFirst = rngFound
Set rngFoundAll = rngFound.EntireRow
Do
Set rngFoundAll = Union(rngFound.EntireRow, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFirst.Address = rngFound.Address
rngFoundAll.Delete
End If
End Sub

--
HTH...

Jim Thomlinson


"Abilio" wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding A string

Sub Test()
Call DeleteRows(Userform1.Textbox4.Text)
End Sub

If you want the whole row deleted change

rngFoundAll.Delete

to

rngFoundAll.EntireRow.Delete



--
Regards,
Tom Ogilvy

"jeramie" wrote in message
...
Jim, How could I adapt that to search for textbox 4's contents, and then
delete?

"Jim Thomlinson" wrote:

You can give this a try...

Sub Test()
Call DeleteRows("Composite")

End Sub

Sub DeleteRows(ByVal DeleteString As String)
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngFirst As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Cells
Set rngFound = rngToSearch.Find(What:=DeleteString, LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Nothing was found to delete.", vbInformation, "Nothing

Found"
Else
Set rngFirst = rngFound
Set rngFoundAll = rngFound.EntireRow
Do
Set rngFoundAll = Union(rngFound.EntireRow, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFirst.Address = rngFound.Address
rngFoundAll.Delete
End If
End Sub

--
HTH...

Jim Thomlinson


"Abilio" wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as

"Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Finding A string

nevermind, I got it.

"jeramie" wrote:

Jim, How could I adapt that to search for textbox 4's contents, and then
delete?

"Jim Thomlinson" wrote:

You can give this a try...

Sub Test()
Call DeleteRows("Composite")

End Sub

Sub DeleteRows(ByVal DeleteString As String)
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim rngFirst As Range

Set wksToSearch = Sheets("Sheet1")
Set rngToSearch = wksToSearch.Cells
Set rngFound = rngToSearch.Find(What:=DeleteString, LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Nothing was found to delete.", vbInformation, "Nothing Found"
Else
Set rngFirst = rngFound
Set rngFoundAll = rngFound.EntireRow
Do
Set rngFoundAll = Union(rngFound.EntireRow, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFirst.Address = rngFound.Address
rngFoundAll.Delete
End If
End Sub

--
HTH...

Jim Thomlinson


"Abilio" wrote:

It would have to be a macro procedure.

"Abilio" wrote:

Would anybody have a macro procedure to find a specific word such as "Composite" in
a column and delete the respective rows where the string were found.

I appreciate the help!

Thank you,

Abilio Andries

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
finding a name in a string jay d Excel Worksheet Functions 1 June 12th 06 09:25 PM
finding what numbers are in a string (Day 2) David Excel Worksheet Functions 0 May 26th 05 10:10 PM
finding what numbers are in a string David Excel Worksheet Functions 3 May 26th 05 10:10 PM
Finding text in a string Paulc Excel Programming 1 December 16th 04 11:55 AM
Finding a string FRAN Excel Programming 2 September 24th 03 01:32 PM


All times are GMT +1. The time now is 11:44 AM.

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"