View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Abilio Abilio is offline
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