Macro to Search

  • Thread starter Thread starter tc
  • Start date Start date
T

tc

Hi. I need to create a macro that will search a text string in a
particular sheet and delete the entire row if the string appears
 
Hi,

A bit short on detail but this looks for "Mytext" in column A and if it
finds it deletes the entire row.

Sub stantial()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
For x = lastrow To 1 Step -1
Cells(x, 1).Select
If ActiveCell.Value = "Mytext" Then
Selection.EntireRow.Delete
End If
Next
End Sub

Mike
 

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

Back
Top