在Excel下拉菜单的焦点后,自动显示选择列表 [英] On focus after tabbing of Excel drop down, automatically show list for selection
问题描述
所以在下拉列表的焦点上,我希望列表出现,所以我可以用箭头向下键选择它,然后按回车键选择它。
任何关于下拉列表和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屋!