There is nothing wrong with your code that I can see. You need to format your cells to text or excel will remove the leading zeroes.