Delete rows if time is greater than present time

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?
 
I

isabelle

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.
 
S

Sabosis

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top