IsDate macro missing some blank cells

Jonathan King

New Member
Joined
Dec 13, 2018
Messages
17
For some reason, IsDate is missing some blank cells and I can't seem to resolve the problem.

The blank cells have been thoroughly checked with IsBlank and IsEmpty and show as blank cells.

What happens is, the blank cells are then subtracted from a date and consistently return a -43524.

IsEmpty(.Range("I" & y).Value) was added as a second check, but some blank cells are still being missed.

Most likely, I'm missing something right before my eyes.

Any ideas?

Thanks beforehand!

----

With Sheets("Test")
lrow2 = .Cells(.Rows.Count, "A").End(xlUp).Row


For y = 1 To lrow2
If Not IsDate(.Range("I" & y).Value) Then
.Rows(y).Delete
End If
Next y

End With
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
In the case given, any cells that are not a date need to be deleted.

The empty cells issue came into play based on my incorrectly going from top-to-bottom , leading to missing cells. Once it was changed to go bottom-to-top, the missing cell issue was resolved.

There are places, where Michael's code will come in handy.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top