I'm trying to move a row based on date to another sheet. The code works and the row moves correctly, but only when all the fields are filled in with a date.
- I also want to move the row when one or more fields are empty, so it only checks the columns that have a date filled in between the range F-H.
- Is tere a way to add all the columns that need to be checked in one line of code? Instead of hardcoding every column?
Code below. Thanks in advance.
Sub MoveBasedOnValue5()
lastrowcurrent = Sheets("Verlopen Keuring").Range("A" & Rows.Count).End(xlUp).Row
lastrowpost = Sheets("Afgehandeld").Range("A" & Rows.Count).End(xlUp).Row
For x = lastrowcurrent To 2 Step -1
If Sheets("Verlopen keuring").Range("F" & x) >= Date And Sheets("Verlopen keuring").Range("G" & x) >= Date And Sheets("Verlopen keuring").Range("H" & x) >= Date Then
Sheets("Verlopen keuring").Range("A" & x).EntireRow.Cut Sheets("Afgehandeld").Range("A" & lastrowpost + 1)
Sheets("Verlopen keuring").Range("A" & x).EntireRow.Delete
lastrowpost = lastrowpost + 1
End If
Next
End Sub