As DataMiser said, remove the On Error Resume Next and an error might come up and explain to you the reason why the loop would not work.