Excel Macro liste déroulante et SendKeys

Résolu
Gaetan95800 Messages postés 10 Statut Membre -  
Gaetan95800 Messages postés 10 Statut Membre -
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 :)
Configuration: Windows Vista
Firefox 3.0.10

1 réponse

  1. pilas31 Messages postés 1878 Statut Contributeur 648
     
    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
    1. Gaetan95800 Messages postés 10 Statut Membre
       
      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