Set AcctRng = Sheets("New Accounts").Range(Cells(2, 1),Cells(countnonblank1 + 1, 1))
CntNBlnk = Application.WorksheetFunction.CountA(AcctRng)
Set MasterSht = ThisWorkbook.Worksheets("Master Data")
LstRo = MasterSht.Cells(MasterSht.Rows.Count, "A").End(xlUp).Row
' Sheets("New Accounts").Range("a5") = LstRo
Set ChoiceRng = Sheets("Master Data").Range(Cells(4, 1), Cells(LstRo, 1))
'Sheets("Master Data").Range(Cells(4, 1), Cells(LstRo, 1))
' Choice = "ChoiceRange"
Sheets("New Accounts").Range(Cells(2, 2), Cells(CntNBlnk + 1, 2)).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=ChoiceRng
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
所有变量都是相应声明的,验证列表代码中的formula1部分是否有一些引用问题?
答案 0 :(得分:0)
,验证列表代码中的formula1部分是否存在一些refrencing问题?
是:ChoiceRng
是一个对象。明确使用.Address
属性:
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:=ChoiceRng.Address