Jovinchious
New Member
- Joined
- Oct 12, 2022
- Messages
- 17
- Office Version
- 2007
- Platform
- Windows
Hi all,
I am trying to erase all rows which do not include my date (for example 17.10.2022) in column A.
Sub DELETEDATE()
Application.ScreenUpdating = False
Dim x As Long
For x = [a1].SpecialCells(xlCellTypeLastCell).Row To 1 Step -1
Debug.Print Cells(x, "A").Value
If CDate(Cells(x, "A")) <> CDate("17/10/2022") Then
Cells(x, "A").EntireRow.Delete
End If
Next x
End Sub
...i use this type of code, and it works completely fine. It just gives an error after finish. Anyone knows how to do it without popping error at the end?
I need error-free code because I have more macro commands that I want to run at the same time, so this is slowing me down.
Tnx!
I am trying to erase all rows which do not include my date (for example 17.10.2022) in column A.
Sub DELETEDATE()
Application.ScreenUpdating = False
Dim x As Long
For x = [a1].SpecialCells(xlCellTypeLastCell).Row To 1 Step -1
Debug.Print Cells(x, "A").Value
If CDate(Cells(x, "A")) <> CDate("17/10/2022") Then
Cells(x, "A").EntireRow.Delete
End If
Next x
End Sub
...i use this type of code, and it works completely fine. It just gives an error after finish. Anyone knows how to do it without popping error at the end?
I need error-free code because I have more macro commands that I want to run at the same time, so this is slowing me down.
Tnx!