ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   make use of cell defined data validation in vba (https://www.excelbanter.com/excel-programming/448583-make-use-cell-defined-data-validation-vba.html)

cate

make use of cell defined data validation in vba
 
In vba, is there a way to exercise/engage the validation already
defined in a cell?? I have cells that have defined data rules but I
seem to be able to set cell values, in vba, to anything I please with
no error generated.

Thank you

Ben McClave

make use of cell defined data validation in vba
 
Cate,

Try Range("A1").Validation.Value. From the help file:

"Returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data)."

Thus, you could use the above property to check whether your changes are valid. If you capture the formula/value in a given range prior to making changes, then you could revert back to this original formula/value in the event that your code generates invalid data.

Ben



All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com