Ok, Claus shows how to assign DV with VBA and so addresses that Q.
What's probably throwing the error is the assignment of the array. The
DV formula needs to be a range or a delimited list. This can be done
using the Join() function...
<snip
Formula1:=Join(MyArray, ",")
...so this works...
Sub InsertDV()
With Selection.Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:=Join(Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), ",")
.IgnoreBlank = True: .InCellDropdown = True
.ShowInput = True: .ShowError = True
End With
End Sub
I wasn't seeing the connection between the array being assigned and
your imported data (assuming there was a connection). I also was
curious about the data source (external file) and how it was being
retrieved, what 'properties' you're setting, etc.!
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion