bonjour
j'ai utilisé ce code dans la meme feuille quelle contient les données
et maintenant j'ai changer mes données vers une autre feuille "TABLE"
SVP aidé moi a modifier ce code pour fonctionne dans la feuille "TABLE"
C1 date
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 Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("C1:C2")) Is Nothing Then Dim doublon As String Dim keyDate As String Dim keyClient As String keyDate = Range("C1").Value keyClient = Range("C2").Value 'maintenant le test sera dans la feuill table Range("E1").Value = IIf(isDoublon(keyDate, keyClient), _ "La date du " & keyDate & " contient le client " & keyClient, _ "") End If End Sub Private Function isDoublon(d As String, client As String) As Boolean Dim r As Range Dim newVal As String Dim key As String key = d & ";" & client isDoublon = False For Each r In sheet("table").Range("b3:b" & Range("b3").End(xlDown).Row) If key = (r.Offset(0, -1).Value & ";" & r.Value) Then isDoublon = True r.Select Exit For End If Next r End Function
C2 client
Partager