如何使用Excel级联下拉菜单清除单元格
我有一个级联下拉列表使用Excel间接函数填充,这一切工作正常。
但是,当第一个下拉列表的值被改变时,我想清除第二个下拉列表的值,因为这现在是无效的。
我该怎么做呢?
Private Sub Worksheet_Change(ByVal Target As Range) Dim oneCell As Range On Error GoTo ErrorOut For Each oneCell In ActiveSheet.Cells.SpecialCells(xlCellTypeAllValidation) If Not oneCell.Validation.Value Then oneCell.ClearContents Next oneCell ErrorOut: Application.EnableEvents = True On Error GoTo 0 End Sub