Kantian, xld is correct in the fact that inbuilt functions in Excel perform faster and are a lot more robust than VBA, aside from that VBA contributes to the size of your workbook. As for the problems you are having - i have no idea what it is, i created the code purely on guess work as you didn't attach a workbook so you got my best shot without it!