Hello all! I'm running into a runtime error '13' type mismatch error with the below code. The code is supposed to delete any row with a date older than two years. Initially I did not have the Int() formula, but for fear that the cell value was not an integer I put it in. Any suggestions?
An example of what is stored in E column is [TABLE="width: 173"]
<tbody>[TR]
[TD="class: xl63, width: 173"]22-04-16 05:49[/TD]
[/TR]
</tbody>[/TABLE]
Thank you in advance for your help.
Code:
' lRow is a predefined variable that finds the last row with a value
Worksheets(1).Range("E4:E" & lRow).Select
For Each cell In Selection
If (Int(Year(cell.Value)) > Int((Year(Now) - 2))) Then
cell.EntireRow.Delete
End If
Next cell
An example of what is stored in E column is [TABLE="width: 173"]
<tbody>[TR]
[TD="class: xl63, width: 173"]22-04-16 05:49[/TD]
[/TR]
</tbody>[/TABLE]
Thank you in advance for your help.
Last edited: