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
| Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, Cancel As Boolean)
If Not Intersect(target, Range("t_Contacts")) Is Nothing Then
Range("j2") = Range("b" & target.Row).Value
Application.SendKeys ("{ESC}")
End If
End Sub
Function ReadData(Tablename As String, Index As Long, Map)
Dim i As Long
Dim t As ListObject
Set t = Range(Tablename).ListObject
For i = LBound(Map) To UBound(Map) Step 2
Range(Map(i)).Value = t.ListColumns(Map(i + 1)).DataBodyRange(Index).Value
Next i
Set t = Nothing
End Function
Private Sub Worksheet_Change(ByVal target As Range)
Dim CellLink As Integer
Dim pLookupValue As String
CellLink = Range("Feuil1!$K$2")
pLookupValue = Range("Feuil1!$J$2")
If target.Address = Range("pLookupValue").Address Then
ReadData "t_Contacts", Range("CellLink").Value, VBA.Array("fm_Prénom", "Prénom", "fm_Nom", "Nom", "fm_DN", "Date naissance", "fm_Actif", "Actif")
End If
End Sub |
Partager