Bonjour a tous
j'ai le code suivant,et je souhaiterais rajouter dans l'userform un bouton annuler.
merci de vos lumieres
cris
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 Option Explicit Private Sub UserForm_Initialize() With Worksheets("AR-Base") Me.ComboBox1.RowSource = "'" & .Name & "'!V3:V" & .Cells(.Rows.Count, "V").End(xlUp).Row End With End Sub Private Sub ComboBox1_Change() Dim Nom As String Dim LaLig As Long If Me.ComboBox1.ListIndex > -1 Then Nom = Me.ComboBox1.Value LaLig = Cherch(Nom) If LaLig > 0 Then With Worksheets("AR-Base") Me.TextBox1 = .Range("U" & LaLig) Me.TextBox2 = .Range("W" & LaLig) Me.TextBox3 = .Range("X" & LaLig) Me.TextBox4 = .Range("Y" & LaLig) .Range("T" & LaLig).Value = "X" .Range("V" & LaLig & ":Y" & LaLig).Interior.ColorIndex = 4 End With End If End If End Sub 'Fonction qui retourne le n° de la ligne où on a trouvé Str en colonne V 'Si le mots Str n'est pas trouvé, elle retourne 0 Private Function Cherch(ByVal Str As String) As Long Dim c As Range Set c = Worksheets("AR-Base").Range("V:V").Find(Str, LookIn:=xlValues, LookAt:=xlWhole) If Not c Is Nothing Then Cherch = c.Row Set c = Nothing End If End Function Private Sub b_fin_Click() Unload Me End Sub
Partager