Bonjour à tous.
Auriez-vous une solution fiable au bug (bien connu) de l'utilisation du sendkeys qui active ou désactive le Numlock ?
Je souhaite qu'une liste déroulante s'ouvre au premier clic et j'utilise le code suivant :
J'ai testé sans succès les solutions suivantes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Range("B4:B9, B22:B25, B36:B39, B43:B45, B53:B56, B67:B70, B82:B83, B99:B103, A131:A131"), Target) Is Nothing And Target.Count = 1 Then Application.SendKeys "%{DOWN}" End If End Sub
Doevents :
En fonction de l'état de la touche Numlock :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Range("B4:B9, B22:B25, B36:B39, B43:B45, B53:B56, B67:B70, B82:B83, B99:B103, A131:A131"), Target) Is Nothing And Target.Count = 1 Then Application.SendKeys "%{DOWN}" Doevents End If End Sub
Pouvez-vous m'aider ? L'ouverture en un clic du menu déroulant m'est vraiment très utile.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Range("B4:B9, B22:B25, B36:B39, B43:B45, B53:B56, B67:B70, B82:B83, B99:B103, A131:A131"), Target) Is Nothing And Target.Count = 1 Then Application.SendKeys "%{DOWN}" If GetKeyState(vbKeyNumlock) = 1 Then Application.SendKeys "{NUMLOCK}" End If End If End Sub
Merci et excellente fin de journée à tous.
Partager