View Full Version : Solved: Check if cell has data validation

05-15-2009, 01:26 PM
I've read some posts about this. Seems the only way to check is to create a function like HasValidation() which checks for the activecell.validation.type but has to generate an error to return False. Is there a cleaner way to determine validation. Stan

05-15-2009, 02:37 PM
Looking at the validation object, it would appear that's the only option. The validation object is instantiated it's just the properties will throw errors if you try to access them.
Although it's worth noting that if the cell had validation and it has since been cleared, accessing the properties won't throw an error, so you also have to check to make sure the formula1 and formula2 properties (of the validation object) are empty.
Another consideration is that if some cells in a range have validation and some do not, then an error will also be thrown, so each cell in the range has to be individually checked.

05-16-2009, 02:59 AM
Thank you.