简体   繁体   English

自动展开下拉列表

[英]Automatically Expand a Drop-Down List

I have a cell with drop-down list in it.我有一个带有下拉列表的单元格。 I manually press the down arrow (on the right of the cell) to show the content of the list.我手动按下向下箭头(在单元格的右侧)以显示列表的内容。 I need a way to automatically expand the list using VBA.我需要一种使用 VBA 自动扩展列表的方法。 How can I accomplish that?我怎样才能做到这一点?

You may try below codes.您可以尝试以下代码。

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
    If Target.Cells.Count = 1 Then
        If Target.Validation.InCellDropdown = True Then
            Application.SendKeys ("%{UP}")
        End If
    End If
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM