ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HowTo:Validation Formula = Array of strings (https://www.excelbanter.com/excel-programming/356962-howto-validation-formula-%3D-array-strings.html)

AMDRIT

HowTo:Validation Formula = Array of strings
 
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




All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com