How to eliminate cells that are before 3:00 PM
How to eliminate cells that are before 3:00 PM
(OP)
I have a question regarding microsoft excel using Visual Basic. I have a worksheet that has a list of activities sorted by "time" which is the first column, the other columns hold other information such as "company" and "name." I want to delete the lines of information that happen before 3:00 PM.
The report looks like the following
TIME COMPANY NAME
7:00 TWP Tony
8:30 CPI Aaron
15:30 FGI Frank
16:00 WTI Anthony
How do I get rid of the two lines before 3pm using Visual Basic Code?
The report looks like the following
TIME COMPANY NAME
7:00 TWP Tony
8:30 CPI Aaron
15:30 FGI Frank
16:00 WTI Anthony
How do I get rid of the two lines before 3pm using Visual Basic Code?





RE: How to eliminate cells that are before 3:00 PM
Sub DeleteRow()
Dim iRow As Integer
iRow = 1
While Cells(iRow, 1) <> ""
If Cells(iRow, 1).Value < TimeSerial(15, 0, 0) Then
Rows(iRow).Select
Selection.Delete Shift:=xlUp
Else: iRow = iRow + 1
End If
Wend
End Sub