i have an excel document, that works fine and produces another file based on the template.

On open of the original document, i have a macro to go and clear any data in particular cells.

When creating the new file, in my macro I have set the new workbook to be protected; however when this file is open, it goes and runs the clear function. This gives an error as it can not clear the cells due to the protection.

I dont want to turn the protection off, so is there anyway I can check for protection, if protection is found, then dont run the clear code,

Thanks.