我在vb中生成一张在EXCEL表,在表中做了一个下拉列表框,让用户选择,生成下拉列表框的vb如下,在这个Formula1:="dsg,sg,sgd"语句中,如果用字符串常量是可以的,如果换成字符串变量就不行,比如变量strTemp="a,b,c", 语句换成Formula1:=strTemp,就出错,请问该如何使用这个变量?With exSheet1.Range("b3").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="dsg,sg,sgd"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="dsg,sg,sgd"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货