View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dileep Chandran Dileep Chandran is offline
external usenet poster
 
Posts: 101
Default Macro - delete entire row which contain a specific text

To the masters of the excel:

I have the following macro. How can I change the range to look up form
(a:a) to multiple ranges. say like Column A, B, C, X, Y and Z?


Sub DeleteRows()
Dim myWord As String
Dim FoundCell As Range
Dim wks As Worksheet


Set wks = Worksheets("sheet1")


myWord = "Test"


With wks.Range("a:a")
Do
Set FoundCell = .Cells.Find(what:=myWord, _
after:=.Cells(.Cells.Count), _
lookat:=xlWhole, MatchCase:=False)
If FoundCell Is Nothing Then
Exit Do
Else
FoundCell.EntireRow.Delete
End If
Loop
End With

Can anyone help me?

Thanks
-Dileep Chandran


End Sub