mmm...this rings a distant bell ! Any chance you could use Record Macro to autogenerate some code to analyse for clues? Also keep an eye on datatypes.
Clivey,London. On Jan 30, 9:15 pm, Rob <robdavis...@btinternet.com> wrote: > Can anyone help please? > > I have tried to apply the following VBA code in order to establish a > validation within a particular cell that will measure the data entry > against date values in other cells: > > With Selection.Validation > .Delete > .Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, > Operator:= _ > xlBetween, Formula1:="=AND($D$14>=C14,$D$14<=I14)" > .IgnoreBlank = True > .InCellDropdown = True > .InputTitle = "#1 Grade Date" > .ErrorTitle = "Invalid value" > .InputMessage = "Please enter the completion date of the > first full disease grade for this screening encounter" > .ErrorMessage = "The #1 Grade Date must be:" & vbNewLine & > _ > "1) a date value equal to or greater than the 'Date > screened AND" & vbNewLine & _ > "2) a date value equal to or less than the '#2 Grade > Date' AND" & vbNewLine & _ > "3) a date value equal to or less than the '#3 Grade > Date' AND" & vbNewLine ' > .ShowInput = True > .ShowError = True > End With > > I have been running the code using the F5 short key in order to apply > the validation parameters to cell D14 and this all works fine however, > upon testing the validation it doesn't work if I enter a date value < > C14 and I14 is blank. If I remove the $D$14<=I14 argument from the AND > function and once again enter a date value < C14 it reports a > validation error as expected. What is it about the additional AND > argument '$D$14<=I14' that is causing problems - what am I missing? > > Many thanks -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel