HowTo:Validation Formula = Array of strings

A

AMDRIT

How do I code cell's validation formula to contain a string of values that
may contain commas?

i.e.
cells(1,1).validation.formula1="""1,000"",""2,000"",""3,000"""

Expected to result
1,000
2,000
3,000

Instead I get
1
000
2
000
3
000

Thanks

I have the following values

A B
1 9/7,000 C
2 10/10,000 B
3 12/32,000 C

I have a function GetLimitList() in code

Function GetLimitList(Filter as string) as String()

GetLimitList = <MyLogic>

End Function

Results in Array(9/7,000,12/32,000)

I then perform

With Names(NamedRange).RefersToRange

.Validation.Delete
.Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:=Join(GetLimitList("C"), ",")
.Validation.IgnoreBlank = True
.Validation.InCellDropdown = True
.Validation.InputTitle = ""
.Validation.ErrorTitle = ""
.Validation.InputMessage = ""
.Validation.ErrorMessage = ""
.Validation.ShowInput = True
.Validation.ShowError = True

End With
 

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