Bonjour,
J'ai trouvé ce code qui me va très bien pour mon application, mais les données saisie sont dans un autre onglet
Comment faire pointer "A1:A11 en rouge sur un autre onglet


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
' rentre ici la plage des données en autocomplétion
Private Const r As String = "A1:A11"
Private sInput As String
' variable de blocage de la procédure Change
Dim blnStop As Boolean
 
Private Sub txtInput_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' gestion des touches d'effacement
    If (KeyCode = vbKeyBack) Or (KeyCode = vbKeyDelete) Then
        blnStop = True
    Else
        blnStop = False
    End If
 
End Sub
 
Private Sub txtInput_Change()
    Dim sWord As String
 
    If blnStop Then
        blnStop = False
    Else
        sInput = Left(Me.txtInput, Me.txtInput.SelStart)
        sWord = GetFirstCloserWord(sInput)
        If sWord & "" <> "" Then
            blnStop = True
            Me.txtInput.Text = sWord
            Me.txtInput.SelStart = Len(sInput)
            Me.txtInput.SelLength = 999999
        End If
    End If
 
End Sub
 
Private Function GetFirstCloserWord(ByVal Word As String) As String
 
    Dim c As Range
    For Each c In ActiveSheet.Range(r).Cells
        If c.Value Like Word & "*" Then
            GetFirstCloserWord = c.Value
            Exit Function
        End If
    Next c
    Set c = Nothing
 
End Function

Private Sub UserForm_Click()

End Sub
Merci de votre aide par avance