Validating dates vb

I want to add "data validation" in a cell(which is variable) using VBA and the range which is to come in the data validation list is also variable. Till now I have been using this Here "range1" is the range which is to come in the data validation list and "rng" is the cell where I want the data validation Dim range1, rng As range Set range1 = range("a1:a5") Set rng = range("b1") With rng With . Add Type:=xl Validate List, Alert Style:=xl Valid Alert Stop, Operator:= _ xl Between, Formula1:="range1" End With End With Dim ws As Worksheet Dim range1 As Range, rng As Range 'change Sheet1 to suit Set ws = This Workbook.

Is there a way to catch this exception and change the display text? Below is my code: This works, but the caveat is that this allows dates that may be out of range of SQL dates less than 1753 or you may have a date range (no future date entries).This does work, but Chris Van Opstal's may be needed for SQL date edits.Or to make the check before and show the error to the user inline? # both sets of missing days such not be in the same calendar so remove one or the other) ) (? =\d) # the character at the beginning a the sring must be a digit ( (? I already tried the On XXXXChanging method, but the exception is thrown before that method is called.

Leave a Reply