|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Public Sub 向单元格添加列表(rng As Range, addlist As String)
- With rng.Validation
- .Delete
- If addlist = "" Then Exit Sub Else .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=addlist
- .IgnoreBlank = True
- .InCellDropdown = True
- .InputTitle = ""
- .ErrorTitle = ""
- .InputMessage = ""
- .ErrorMessage = ""
- .IMEMode = xlIMEModeNoControl
- .ShowInput = True
- .ShowError = False
- End With
- End Sub
复制代码 第一个参数,单元格区域,第二个参数,传入的列表,string类型,英文逗号分隔符,如"123,234,456,789"
|
|