如何使用vbs在excel中添加下拉列表 [英] how to add a drop down list in excel using vbs

查看:63
本文介绍了如何使用vbs在excel中添加下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用vbs在Excel中添加下拉菜单,并且出现以下错误.

Hi I am trying to add a drop down in a excel using vbs and i am getting the below error.

vbs(18, 15) Microsoft VBScript compilation error: Syntax error

我什至录制了一个marco并从那里使用了代码,但仍然行不通.

I even recorded a marco and used the code from there still it didn't work.

第18行和第15行是带有add关键字的行.

Line 18 and col 15 is the line with the add keyword.

Range("A1").Select
    With Selection.Validation
        .Delete
        .Add (Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
        xlBetween, Formula1:="=$Q$9:$Q$11")
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputTitle = ""
        .ErrorTitle = ""
        .InputMessage = ""
        .ErrorMessage = ""
        .ShowInput = True
        .ShowError = True
    End With

Q9:Q11有一个样本数据集我在做什么错了?

Q9:Q11 has a sample data set What am i doing wrong?

推荐答案

您需要替换 xlValidateList 的固有常数及其直接的

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆