【发布时间】:2017-01-21 06:07:20
【问题描述】:
我有一个 With 块,它有一个条件来查看下拉列表中是否存在值。
With wb.Sheets("BudgetLines").DropDowns("Drop Down 22")
For Each c In refData.Range("G7:G" & LastRow_RefData).Cells
Set Findo = wb.Sheets("BudgetLines").Cells.Find(c.Value, LookIn:=xlValues, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious, _
MatchCase:=False, SearchFormat:=False)
If Findo Is Nothing Then
Debug.Print "Name was not found."
'DropDowns("Drop Down 22").Clear
Else
Debug.Print "Name found in :" & Findo.Address
'Add title to drop down box
.AddItem c.Value
End If
Next
End With
但是,我想完全清除下拉列表。我已经尝试过 .Clear 但它似乎没有收到,因为它位于 With 块中。
有没有办法在 With 块中做到这一点?
【问题讨论】:
-
你试过 .ClearContents 吗?
-
没有多少指向
With阻止一个成员调用。
标签: excel with-statement vba