預設須點擊儲存格右側下拉箭頭才會顯示資料驗證清單。透過簡單的 VBA 事件程序,選取儲存格即自動展開清單:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 3 Then Application.SendKeys "%{DOWN}"
If Target.Column = 4 Then Application.SendKeys "%{DOWN}"
End Sub
代碼意義:選取第 3、4 欄(C、D 欄)任一儲存格時,模擬 Alt+Down 熱鍵自動展開下拉選單。可依需求修改欄號。
