View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
salgud salgud is offline
external usenet poster
 
Posts: 219
Default What happens to data validation when created from VBA?

I've been working with data validation on a spreadsheet project I've been
doing. It seems that if I put custom/complex data validation criteria into
the Custom Formula field directly, they work fine. But when I put them in
using VBA, they no longer work properly - the won't validate correct data.

I've done this with a number of different formulas. E.g., the formula

=MONTH(H7)=MONTH(I7)

works fine entered by VBA. But, the formula

=and((I7H7),month(I7)=month(H7),year(I7)=year(H7) ,i7(month(G7),day(G7),year(G7)+21))

doesn't. It won't validate an entry that meets all these criteria.

I've done a fair amount of research online (as well as looking through my
various XL manuals) and haven't found an answer. I've used formulas that I
found online to see if it's just my formulas, and it's not.

So what's going on here? Is there a trick to entering formulae as
validation criteria via VBA that I'm missing?

I'm using XL2003. Thanks for the help.