excel - vba在变量范围上创建下拉列表
问题描述
我现在搜索了很多,我不知道问题出在哪里。其他人也这样做了,而且效果很好。
这是我的代码,如果有人可以帮助我,那就太棒了。先感谢您!
错误发生在“.Add Type”行
Sub dropDownMenu()
Do While (Worksheets("x").Cells(counter + 2, 1) <> "")
counter = counter + 1
Loop
Worksheets("y").Range("D36:D36") = ""
With Worksheets("y").Range("D36:D36").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=x!A2:A" & 1 + counter & ""
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = "xxx"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
解决方案
推荐阅读
- c++ - 架构不固定时如何使用平面缓冲区?
- javascript - 如何在chartjs上强制动画?
- c++ - 括号(预期声明)
- python - 如何使用 Flask-admin 按 id 分隔视图模型?
- c# - 错误:您与此站点的连接不是私有的 Asp.Net。MVC5
- ssl - Spring Data Couchbase 通过 SSL 连接
- listview - 如何在 Flutter 中添加 ListView.builder 的填充顶部?
- maven - 如何在 IntelliJ IDEA 中构建多个模块
- c++ - 模板 (.tpp) 文件包括警卫
- ajax - 如何将 AJAX 用于依赖下拉列表?