Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.
Sub DelOOETranslations() 'Assumes that oldest or OOE are first Dim WS As Worksheet Dim MaxRow As Long, I As Long Dim ThisDate As Date Set WS = ActiveSheet MaxRow = LastRow I = 6 Do '---> Check for Cell if Date and Affect to ThisDate If Len(WS.Cells(I, "D")) = 20 And Mid(WS.Cells(I, "D"), 3, 1) = "/" Then ThisDate = DateValue(Left(WS.Cells(I, "D"), 10)) End If '---> Test if Date captured < now then delete or else increment counter go next line If ThisDate < DateValue(Now) Then WS.Cells(I, "A").EntireRow.Delete MaxRow = MaxRow - 1 Else I = I + 1 End If Loop Until I > MaxRow '---> Advise results to user 'MsgBox ("All date prior to " & DateValue(Now) & " have been deleted with their coresponding rows successfully.") End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
19 Experts available now in Live!