ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Deleting entire row if cell contains "value" - how to review everytime? (https://www.excelbanter.com/excel-worksheet-functions/199080-deleting-entire-row-if-cell-contains-value-how-review-everytime.html)

V[_2_]

Deleting entire row if cell contains "value" - how to review everytime?
 
Hi~

I found this great macro which works perfectly on my dataset to delete
the entire row if a cell value in column A contains a certain word.

What I would like is to add a code which lets me review and hit accept/
decline every time it cycles through. What kind of code would I add to
it?

Thanks!


' *** delete if a cell contains "xxx" ***

Sub DeleteRelay()
Dim c As Range
With Activesheet.Range("A:A")
Do
Set c = .Find("xxx", LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub

' *** ***

smartin

Deleting entire row if cell contains "value" - how to reviewevery time?
 
V wrote:
Hi~

I found this great macro which works perfectly on my dataset to delete
the entire row if a cell value in column A contains a certain word.

What I would like is to add a code which lets me review and hit accept/
decline every time it cycles through. What kind of code would I add to
it?

Thanks!


[untested]

' *** delete if a cell contains "xxx" ***

Sub DeleteRelay()
Dim c As Range
With Activesheet.Range("A:A")
Do
Set c = .Find("xxx", LookIn:=xlValues, lookat:=xlPart, _
MatchCase:=False)
If c Is Nothing Then Exit Do
if msgbox("delete?", vbYesNo) = vbYes then
c.EntireRow.Delete
end if
Loop
End With
End Sub

' *** ***


All times are GMT +1. The time now is 10:56 AM.

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