Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Delete rows with date more than 48 hours with a condition..
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Paul Wilson, post: 6371046"] Here is one solution. Public Sub Test() Dim rng As Range Dim cel As Range Dim iCounter As Integer Dim iLastRow As Integer Dim dtToday As Date Dim dtCellDate As Date Set rng = Range("J1:J100") 'Change the J-rows as appropriate iLastRow = rng.Cells.Count For iCounter = iLastRow To 1 Step -1 'Workup from the bottom! With rng If .Cells(iCounter).Value = "ABC" Then dtToday = Date 'Today's date dtCellDate = .Cells(iCounter).Offset(0, 1).Value 'Date value in K cell. If dtToday - dtCellDate >= 2 Then .Cells(iCounter).EntireRow.Delete End If End If End With Next End Sub Paul [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Delete rows with date more than 48 hours with a condition..
Top