ws.Cells(i, 10).Value = Application.WorksheetFunction.CountIfs(rng, ">=" & CLng(startdate), rng, "<=" & CLng(endDate))
changing this line solved my problem as suggested by p45cal and Debaser.
Monty sir, I was worried because my data formats were double checked. I incorporated changes given by...