Normally it is possible to apply data validation in excel through vba but i am having a specific problem I am using the indirect method for applying validation,normally when i dont use vba i get a warning by excel that "source currently evaluates to an error,do u want to continue?
Add Type:=xl Validate List, Alert Style:=xl Valid Alert Stop, Operator:= _ xl Between, Formula1:= _ "=INDIRECT(" & cell To Be Referred & ")" i know what the error is.simply when Q11 and Z11 are not specified the string would become is_depth_(nothing here)_(nothing here)_values...since it is not a named range it gives an error.problem is excel would let me continue because later i can input Q11 and Z11 and the validation will be available.vba wont let me continue...
Soliciting data from users is a common use for a Word User Form, but a typo, a correctly spelled but invalid value, or even a control left blank can render your document unusable.
Fortunately, you can include a bit of VBA code to check input values for specific attributes.
In this article, we'll look at simple examples of validating input values before committing them to the document.
This article's example form and controls assume you have basic knowledge of Word's User Form object.
If you don't know how to create a User Form, consider reading 10 steps to creating a Word userform for addressing letters before you continue.To simplify the examples, we'll change only the properties necessary to support the technique at hand.You can work with your own User Form or download the demonstration or file.Note: Don't copy and paste the code from this web page, because some web-based characters will return errors.You can think of validating data in terms of opening a door, and that door can be: Names present the most common use of an open control; the door is open and any name can pass through to your document.Displaying the input value and asking the user to confirm the value before committing it can help, but beyond that, you can do little to validate this type of input—anything the user enters can pass through the door. The value must pass a few tests before the code allows it to pass through.