Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Cell <= specific time, Delete row 1

Status
Not open for further replies.

RP1America

Technical User
Aug 17, 2009
221
US
Column H is formatted as:

Code:
Columns("H:H").NumberFormat = "h:mm:ss;@"

I want to delete any row that has a time of 15:59:59 or prior. The following code is deleting every row.

Code:
        If Cells(i, "H").Value <= Format("15:59:59", "hh:mm:ss") Then
            Cells(i, "A").EntireRow.Delete
        End If

Any suggestions?
 
Got it!

Code:
        If Cells(i, "H").Value <= TimeValue("15:59:59") Then
            Cells(i, "A").EntireRow.Delete
        End If
 


Code:
   With Cells(i, "H")
        If .Value <= TimeValue("15:59:59") Then
           .EntireRow.Delete
        End If
   End with
Or no loop involved: Just FILTER using Criteria:<= TimeValue("15:59:59") and DELETE all visible DATA rows.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top