Hi,
Can someone help me with the next problem?
I would like to create a Macro which deletes the line if the date value in a certain column is in the past.
Thanks for your feedback,
Leentje
Hi,
Can someone help me with the next problem?
I would like to create a Macro which deletes the line if the date value in a certain column is in the past.
Thanks for your feedback,
Leentje
Hi paste this code in to the worksheet module, every time the sheet is activated it will search through the specified range and delete everything older than today!
Hope it helps.
Regards,
Simon
Option Explicit
Private Sub Worksheet_Activate()
Dim mycell
Dim rng As Range
Set rng = Range("A1:A100")
For Each mycell In rng
If mycell.Value < Date Then
Application.ScreenUpdating = False
mycell.EntireRow.Delete
End If
Next
Application.ScreenUpdating = True
End Sub
When executing this macro, the odd lines are not checked.
When executing the macro again various times the final result is ok.
So I think I need to add some additional code to solve this...
Can you help?
The code worked fine for me as long as the range it checks is formatted in Date format.
Regards,
Simon
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks