Stan,
Your code will give an error, you don't need the end if because the if statement is all contained on the single line.
I also think the next i should go before cells.select as otherwise you are just repeating the lines from cells.select to clearcontents, no need to have those in the loop.
The code I posted in post 2 should be correct.
Bookmarks