View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KurviousKoala KurviousKoala is offline
external usenet poster
 
Posts: 3
Default Using VBA to set Excel Data Validation

Hey there,

I currently use a 'two-tier' data validation rule. the first being:
Data¦Validation¦List
Source:
=List1 'this has 4 arguments

The second list is fed from this List1 as:
=CHOOSE(VLOOKUP(E4,List1_Elements,2,FALSE),List2a, List2b,List2c,List2d)

When applying the second validation, Excel naturally gives an eror:
'The source currently equates to an error. Do you wish to continue?'
I press 'Yes' and the process works....

I need to recreate this setup process in VBA. However, when I get to the
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:= _

"=CHOOSE(VLOOKUP(E4,List1_Elements,2,FALSE),List2a ,List2b,List2c,List2d)"

VBA crashes as it cannot handle the Excel error....

How do i get around this?!?

thx