View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AB[_2_] AB[_2_] is offline
external usenet poster
 
Posts: 236
Default Dropd Down (validation: list) on the fly with a code - a problem

Hi,

I was hoping if anyone could help me - i'm trying to write a code that
would create a dropdown in a cell on the fly. That's the simple code:

With Selection.Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="1;2"
.InCellDropdown = True
End With

So far so good, but the problem is that i want the dropdown to let the
user enter either 1 or 2 but if i run the above code then the dropdown
lets the user enter only one value = "1;2".
In the meantime if i enter the same list ("1;2") manualy into the
validation (Datavalidation - i.e., don't do it with a code) - then
everything is fine - i.e., the dropdown offers either value ("1" or
"2") and not the combined ("1;2").

The point is that i'll need to define the dropdown lists on the fly
and they'll constantly change, that's why i wanted to do that with a
code.

Any help would be greatly appreciated.
Thanks!