Bonjour à tous,
J'utilise le code suivant pour faire une recherche dans une table depuis un formulaire. J'active le formulaire depuis l'onglet "Accueil' et la table se trouve dans l'onglet "Licenciés".
Comment puis-je faire pour éviter les deux instructions Worksheet().Activate ?
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 Worksheets("Licenciés").Activate Feuil1.Cells.Find(What:=Nom, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Select Index = ActiveCell.Row With Sheets("Licenciés") Me.Prénom.Value = .Range("A" & Index) Me.Nom.Value = .Range("B" & Index) Me.DateNaissance.Value = .Range("C" & Index) Me.Rue1.Value = .Range("D" & Index) Me.Rue2.Value = .Range("E" & Index) Me.Rue3.Value = .Range("F" & Index) Me.CodePostal.Value = .Range("G" & Index) Me.Ville.Value = .Range("H" & Index) Me.Domicile.Value = .Range("I" & Index) Me.Domicile2.Value = .Range("J" & Index) Me.Mobile.Value = .Range("K" & Index) Me.Autre.Value = .Range("L" & Index) Me.Messagerie1.Value = .Range("M" & Index) Me.Messagerie2.Value = .Range("N" & Index) Me.Messagerie3.Value = .Range("O" & Index) Me.Messagerie4.Value = .Range("P" & Index) Me.PersonneAPrévenir1.Value = .Range("Q" & Index) Me.PersonneAPrévenir2.Value = .Range("R" & Index) Me.PersonneAPrévenir3.Value = .Range("S" & Index) Me.Tél1.Value = .Range("T" & Index) Me.Tél2.Value = .Range("U" & Index) Me.Tél3.Value = .Range("V" & Index) Me.Catégorie.Value = .Range("W" & Index) Me.Licence = .Range("X" & Index) Me.LicenceT.Value = .Range("Y" & Index) Me.EnCours.Value = .Range("Z" & Index) End With Worksheets("Accueil").Activate
Merci par avance.
Partager