Option Explicit
'Option Compare Text 'Ignores case sensitivity
Sub Macro2()
Dim lngMyRow As Long
Application.ScreenUpdating = False
For lngMyRow = Cells(Rows.Count, "L").End(xlUp).Row To 2 Step -1 'Works backwards up Col. L to Row 2. Change to suit if necessary.
If Range("L" & lngMyRow) = "DELETE ME" Then 'Case sensitive. If you don't want case sensitivity, comment out the line of code immediately under Option Explicit
Rows(lngMyRow).EntireRow.Delete
End If
Next lngMyRow
Application.ScreenUpdating = True
End Sub
Ok and sorry, I just though of this. If I delete the whole row then it will erase the formula in L for future additions to that sheet. Can I get a macro that clear contents just from A:F on that row?
Option Explicit
'Option Compare Text 'Ignores case sensitivity
Sub Macro2()
Dim lngMyRow As Long
Application.ScreenUpdating = False
For lngMyRow = Cells(Rows.Count, "L").End(xlUp).Row To 2 Step -1 'Worksbackwards up Col. L to Row 2. Change to suit if necessary.
If Range("L" & lngMyRow) = "DELETE ME" Then 'Case sensitive. If you don't want case sensitivity, comment out the line of code immediately under Option Explicit
Range("A" & lngMyRow & ":F" & lngMyRow).ClearContents
End If
Next lngMyRow
Application.ScreenUpdating = True
End Sub
I am wanting to assign this macro to a button on another sheet. Will this still work?
Option Explicit
'Option Compare Text 'Ignores case sensitivity
Sub Macro2()
Dim wsMyTab As Worksheet
Dim lngMyRow As Long
Application.ScreenUpdating = False
Set wsMyTab = Sheets("Overage Tracking Running Report")
For lngMyRow = wsMyTab.Cells(Rows.Count, "L").End(xlUp).Row To 2 Step -1 'Worksbackwards up Col. L to Row 2. Change to suit if necessary.
If wsMyTab.Range("L" & lngMyRow) = "DELETE ME" Then 'Case sensitive. If you don't want case sensitivity, comment out the line of code immediately under Option Explicit
wsMyTab.Range("A" & lngMyRow & ":F" & lngMyRow).ClearContents
End If
Next lngMyRow
Set wsMyTab = Nothing
Application.ScreenUpdating = True
End Sub