Excel Macro liste déroulante et SendKeys

Résolu
Gaetan95800 Messages postés 10 Date d'inscription   Statut Membre Dernière intervention   -  
Gaetan95800 Messages postés 10 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

J'aimerais inserer la dedans ;

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.Intersect(Target, Range("Saisie")) Is Nothing Then Exit Sub

With Target
If .Rows.Count > 1 Or .Columns.Count > 1 Then Exit Sub
With .Validation
.Modify Formula1:="=ListInitiale"
End With
End With
SendKeys "%{DOWN}", False
End Sub

Ceci ;

'If Application.Intersect(Target, Range("aatest")) Is Nothing Then Exit Sub
'SendKeys "%{DOWN}", False

Il est pas possible de faire 2x Worksheet_selection, malheureusement :)

du genre --> :)

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.Intersect(Target, Range("aatest")) Is Nothing Then Exit Sub
SendKeys "%{DOWN}", False
End Sub

Merci :)
A voir également:

1 réponse

pilas31 Messages postés 1825 Date d'inscription   Statut Contributeur Dernière intervention   646
 
Bonjour,

Je propose de modifier comme cela pour inclure les deux cas :

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.Intersect(Target, Range("Saisie")) Is Nothing Then
    If Not (Application.Intersect(Target, Range("aatest")) Is Nothing) Then
        SendKeys "%{DOWN}", False
    End If
Else
    With Target
        If .Rows.Count = 1 And .Columns.Count = 1 Then
            With .Validation
                .Modify Formula1:="=ListInitiale"
            End With
        End If
    End With
    SendKeys "%{DOWN}", False
End If
End Sub


A+
0
Gaetan95800 Messages postés 10 Date d'inscription   Statut Membre Dernière intervention  
 
Merci pour ton aide pilas, j'ai même pu inclure un 3ème cas, identique au 2ème.
Si par hasard je veux inclure un cas identique au 1er ? (par curiosité :))
Merci
0