我有一个会话,我尝试将列表类型验证放到不连续的范围内。列表范围来自另一个名为(Range5)的工作表。
With Range("storeRanges").Cells.Validation
Dim ValidationList As Variant
ValidationList = Sheet2.Range("Range5")
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:=Join(ValidationList, ",")
End With
我在 .add行上收到“无效的程序调用或参数”。谢谢你的帮助!
答案 0 :(得分:0)
Soo,解决方案是:
With Range("storeRanges").Cells.Validation
Dim ValidationList As Variant
ValidationList = Sheet2.Range("Range5")
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlEqual, Formula1:="=Range5"
End With
请注意.Delete
和Formula1:="=Range5"
。