Hi Ladies and Gents,
I am trying to check a cell to see if it contains "Deactivation" and if it does check to see if the cell next to it contains "Prepaid" if both are true delete the entire row if either one is not true move on to the next.
Attached is a sample of my data (some columns blanked out for security reasons.) The code i have currently just deletes anything that is a deactivation.
Sub del_Prepaid_Deact()
Dim myDate As Date, aDate, bottomL As Integer, x As Integer, e As Range
'Rename Worksheet to "Generated and Todays Date"
myDate = Date + 7 - Weekday(Date)
aDate = Format(myDate, "dd.mm.yyyy")
Sheet1.Name = "Generated " & aDate
'/Rename Worksheet to "Generated and Todays Date"
' Remove "Prepaid Deactivations"
On Error Resume Next
Sheets("Generated " & aDate).Activate
bottomL = Sheets("Generated " & aDate).Range("A" & Rows.Count).End(xlUp).Row: x = 2
For Each e In Sheets("Generated " & aDate).Range("Q1:Q" & bottomL)
If e.Value = "Deactivation" Then
e.EntireRow.Delete
x = x + 1
End If
Next e
Columns("A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
'/Remove "Prepaid Deactivations"
End Sub
Any help greatly received.
Thank you in advance
Rich
Bookmarks