Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete if
I need help with this macro
IF rows are hidden it work fine, but if its rows delete then it skips some records. what i want is the loop to delete from bottom up , which should resolve the issue or any suggestions. Many thanks Sub deleterecd() ' delete records that are more than 12 months old. coldep = 23 For i = 2 To Cells(65000, coldep).End(xlUp).Row If Cells(i, coldep) < DateSerial(Year(Date), Month(Date) - 12, Day(Date)) Then Rows(i).Delete End If Next i End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
delete if
Try
For i = Cells(65000, coldep).End(xlUp).Row to 2 step -1 flow23 wrote: I need help with this macro IF rows are hidden it work fine, but if its rows delete then it skips some records. what i want is the loop to delete from bottom up , which should resolve the issue or any suggestions. Many thanks Sub deleterecd() ' delete records that are more than 12 months old. coldep = 23 For i = 2 To Cells(65000, coldep).End(xlUp).Row If Cells(i, coldep) < DateSerial(Year(Date), Month(Date) - 12, Day(Date)) Then Rows(i).Delete End If Next i End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I can't delete a cell without deleting a row | Excel Discussion (Misc queries) | |||
Macro to delete a group of CELLS | Excel Discussion (Misc queries) | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) | |||
how do I delete a worksheet from my workbook | New Users to Excel | |||
Delete row depending on criteria | Excel Discussion (Misc queries) |