When validating data with Type:=xlValidateList
Formula1
can be either a comma separated list or a formula string that is a reference to a range with this list. In a comma-separated list, a comma has special meaning. In reference to the range it does not have.
So, suppose your list, which you associate with wksCalculation.Cells(r, lActivityNoColumn)
, is in Sheet2!A1:A5
, then
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Sheet2!A1:A5"
will work.
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=" & wksCalculation.Range("A1:A5").Address(External:=True)
should also work.
source share