ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Search (https://www.excelbanter.com/excel-programming/397230-macro-search.html)

tc

Macro to Search
 
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


Mike H

Macro to Search
 
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

"tc" wrote:

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




All times are GMT +1. The time now is 03:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com