Hi,

I'm using the below formula to check if the User has entered a valid date format e.g 30/09/06 is valid but 30/0906 isn't as will as checking I check that the the tab name which is always a month and year e.g September06 is always equal the Tab year.

It's there a way to shorten the code or could it be converted into a macro to check each sheet.

PS. I know I could use data validation to control user enter but wanted to avoid that if possible

=IF(TEXT(YEAR(D2),"####")="20"&RIGHT(MID(CELL("filename"),FIND("]",CELL("filename"))+1,99),2)=TRUE,"","Wrong year !!")&IF(ISERROR(AND(ISNUMBER(D2),OR(CELL("Format",D2)={"D1","D2","D3","D4","D5"}))),"","<<< Error Check date format")

VBA Noob