我目前正在开发一些 Excel 宏,我必须使用单元格验证。
我查看了很多样本,它们基本上显示了相同的内容,但我无法让它正常工作。
这是我的代码:
Dim val As String: val = "this,is,sparta"
With ActiveSheet.Range("C:C").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=val
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
但最后,我在下拉列表中没有三个选项(“this”、“is”和“sparta”),而是只有一个,等于“This,is,sparta”。
我错过了配置中的任何内容吗?
提前致谢。