J
Josh Sale
I want to create a UDF that when placed in a cell will create a validation
for that cell. The challenge is how to keep the UDF in the cell's formula
when the user makes a selection from the validation's drop-down list?
So for example, I might have a UDF
Function foo() As Variant
With Application.Caller.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="a,b,c"
.InCellDropdown = True
End With
foo = "a" ' make sure the cell starts with a valid selection
End Function
So somebody can then type "=foo" into cell A1 to have the validation list
added.
However when the user makes a selection (e.g., b or c) from the validation,
I don't want to lose "=foo" as the formula.
Any suggestions?
TIA,
josh
for that cell. The challenge is how to keep the UDF in the cell's formula
when the user makes a selection from the validation's drop-down list?
So for example, I might have a UDF
Function foo() As Variant
With Application.Caller.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:=xlBetween, Formula1:="a,b,c"
.InCellDropdown = True
End With
foo = "a" ' make sure the cell starts with a valid selection
End Function
So somebody can then type "=foo" into cell A1 to have the validation list
added.
However when the user makes a selection (e.g., b or c) from the validation,
I don't want to lose "=foo" as the formula.
Any suggestions?
TIA,
josh