Formula1 Property of Validation Object to refer to function name

G

gregl

In Excel 2003, how do I get the Formula1 property of the Validation
object to refer to a function name?

This gives me error 1004:

Sub Macro1()

With Selection.Validation
.Delete
'.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=$A$15:$A$19" 'recorded my macro
recorder, works fine.
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:=GetList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub


Public Function GetList()
Dim arrayList(1 To 5) As String

arrayList(1) = "aaa"
arrayList(2) = "ccc"
arrayList(3) = "bbb"
arrayList(4) = "ddd"
arrayList(5) = "eee"

GetList = arrayList
End Function
 
G

Greg Lovern

Any suggestions? From the thread referenced in the last post, it sounds
like this should be possible.

Thanks,

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top