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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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