PcMax,

The best thing to do would be to attach your file, and tell the expected output. We can then device a code that will do the needed, and you can then study the code and understand what could have been done better. Otherwise, from just looking at the code, yes one change that I would suggest is to use Option Explicit and declare all the variables as required.