This is validation. You have no error checking (correctly referred to as error trapping).
the first part of the If statement
You mean the IIF part? I don't see anything wrong with your If block.
As for the expression, dateserial returns a date, but since you haven't declared ran as anything, I suspect you need to wrap the variable in date delimiters (#). I also suspect you don't use (or at least haven't in this procedure) Option Explicit since you don't seem to declare ran, days or delta. In that case, you're just asking for trouble.
Wondering if you couldn't make this simpler using DateDiff function.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.