ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete rows if time is greater than present time (https://www.excelbanter.com/excel-programming/447913-delete-rows-if-time-greater-than-present-time.html)

Sabosis

Delete rows if time is greater than present time
 
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.

Any ideas on how this would be done?

isabelle

Delete rows if time is greater than present time
 
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.

Any ideas on how this would be done?


Sabosis

Delete rows if time is greater than present time
 
On Saturday, December 29, 2012 5:55:12 PM UTC-8, isabelle wrote:
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.



Any ideas on how this would be done?




Thank you so much!


All times are GMT +1. The time now is 03:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com