在Excel下拉菜单的焦点后,自动显示选择列表 [英] On focus after tabbing of Excel drop down, automatically show list for selection

查看:211
本文介绍了在Excel下拉菜单的焦点后,自动显示选择列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些excel中的数据验证下拉列表,我可以通过所有的列表,但我必须按Alt +向下箭头来显示列表,他们的方式,一旦我专注于自动显示选项卡。

所以在下拉列表的焦点上,我希望列表出现,所以我可以用箭头向下键选择它,然后按回车键选择它。

任何关于下拉列表和VBA的其他有用的提示将会很棒!

解决方案

编辑:仍然使用VBA发送键。 p>

在数据验证单元所在的工作表中(假设它是Sheet1上的单元格A1:C1),请在Microsoft Excel Sheet1模块中放置以下代码与第一张表相关的VBA代码)

  Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo Err1:

如果Target = Range(A1)然后
Application.SendKeys(%{UP})
End If

如果Target = Range(B1)然后
Application.SendKeys(%{UP})
End If

如果Target = Range C1)然后
Application.SendKeys(%{UP})
End If

Err1:
'do nothing
End Sub


I have some data validation drop down lists in excel, I can tab through all the lists but I have to press alt + down arrow to show the list, Is their a way it can be automatically shown as soon as I focus on the tab.
So on focus of the drop down list, I would like the list to appear So that I can select it with the arrow down key and hit enter to select it.
Any other helpful tips for drop down lists and VBA would be great!

解决方案

edit: still using VBA send keys.

On the sheet where the data validation cell resides (assumed it is cells A1:C1 on Sheet1), put in the following code in the Microsoft Excel Sheet1 Module (the module that holds the VBA code that is related to the first sheet)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error GoTo Err1:

    If Target = Range("A1") Then
        Application.SendKeys ("%{UP}")
    End If

    If Target = Range("B1") Then
        Application.SendKeys ("%{UP}")
    End If

    If Target = Range("C1") Then
        Application.SendKeys ("%{UP}")
    End If

Err1:
    'do nothing
End Sub

这篇关于在Excel下拉菜单的焦点后,自动显示选择列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆