Your code worked fine for me. What line produces the error? Could you upload a sample workbook that produces the error?