Solved: Check if cell has data validation
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
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.
Keep Our Board Clean!
- Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.