Hi
Table1 contains 6 columns of which column 6 is in a short date format.
The date in column 6 must be automatically deleted if less than 7 days from the current date or a date in another cell - control cell.
The code below gives error 424 Object required. The code runs from the workbook.
Option Explicit
Sub DeleteRows()
Dim LastRow As Range
Dim i As Integer
Set LastRow = ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
For i = LastRow To 2 Step -1
If ThisWorkbook.Worksheets("Sheet1").Cells(i, 6).Value < Date Then
Rows(i).Delete
End If
Next
ThisWorkbook.Worksheets("Sheet1").Cells(i, 1).Select
End Sub
Can someone kindly assist me?
Table1 contains 6 columns of which column 6 is in a short date format.
The date in column 6 must be automatically deleted if less than 7 days from the current date or a date in another cell - control cell.
The code below gives error 424 Object required. The code runs from the workbook.
Option Explicit
Sub DeleteRows()
Dim LastRow As Range
Dim i As Integer
Set LastRow = ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count, 2).End(xlUp).Row
For i = LastRow To 2 Step -1
If ThisWorkbook.Worksheets("Sheet1").Cells(i, 6).Value < Date Then
Rows(i).Delete
End If
Next
ThisWorkbook.Worksheets("Sheet1").Cells(i, 1).Select
End Sub
Can someone kindly assist me?