Delete rows if time is greater than present time

  • Thread starter Thread starter Sabosis
  • Start date Start date
S

Sabosis

Hello-

I have a spreadsheet that has times by 1/2 hour in column A for our workday.. The spreadsheet will always have the full workday of information in it over the past 4 weeks for the same day (last 4 Mondays, etc). I want to be able to open this spreadsheet and delete any rows that have a greater time incolumn A than the current time of the present day.

Any ideas on how this would be done?
 
hi Sabisis,

Private Sub Worksheet_Activate()
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1) < Now Then Rows(i).Delete Shift:=xlUp
Next
End Sub



isabelle


Le 2012-12-29 15:48, Sabosis a écrit :
Hello-

I have a spreadsheet that has times by 1/2 hour in column A for our workday.

The spreadsheet will always have the full workday of information in it
over the past 4 weeks for the same day (last 4 Mondays, etc).

I want to be able to open this spreadsheet and delete any rows that
have a greater time in column A than the current time of the present day.
 
hi Sabisis,



Private Sub Worksheet_Activate()

Dim i As Long

For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1

If Cells(i, 1) < Now Then Rows(i).Delete Shift:=xlUp

Next

End Sub







isabelle





Le 2012-12-29 15:48, Sabosis a écrit :




The spreadsheet will always have the full workday of information in it

over the past 4 weeks for the same day (last 4 Mondays, etc).



I want to be able to open this spreadsheet and delete any rows that

have a greater time in column A than the current time of the present day.

Thank you so much!
 
Back
Top