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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
| Option Explicit
Private Sub Ok_Click()
Dim i As Integer
'feuille contenant la valeur à chercher
With Sheets("CLIENTS")
'de la ligne 2 à la dernière ligne utilisée de la colonne A
For i = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
'recherche de la ligne en colonne A qui correspond à la sélection du combobox1
If .Cells(i, 1).Text = Me.ComboBox1 Then
'si oui ComboBox1 = colonne suivante même ligne
tbxAdresse1 = .Cells(i, 4).Text
tbxAdresse2 = .Cells(i, 5).Text
tbxcp = .Cells(i, 7).Text
tbxville = .Cells(i, 8).Text
tbxpays = .Cells(i, 10).Text
tbxmoyenpaiement = .Cells(i, 21).Text
tbxAdresse1Livraison = .Cells(i, 13).Text
tbxAdresse2Livraison = .Cells(i, 14).Text
tbxcpLivraison = .Cells(i, 16).Text
tbxvilleLivraison = .Cells(i, 17).Text
tbxpaysLivraison = .Cells(i, 19).Text
Exit For
End If
Next
End With
End Sub
Private Sub Imprime_Click()
UserForm1.Printform
End Sub
Private Sub Efface_Click()
'efface la sélection des texboxs
tbxproduit.Text = ""
tbxlieu.Text = ""
tbxprix.Text = ""
tbxdestinataire.Text = ""
tbxClientsFact.Text = ""
tbxClientsLivr.Text = ""
tbxAdresse1.Text = ""
tbxAdresse2.Text = ""
tbxcp.Text = ""
tbxville.Text = ""
tbxpays.Text = ""
tbxmoyenpaiement.Text = ""
tbxAdresse1Livraison.Text = ""
tbxAdresse2Livraison.Text = ""
tbxcpLivraison.Text = ""
tbxvilleLivraison.Text = ""
tbxpaysLivraison.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
End Sub
Private Sub Quitter_Click()
Me.Hide
End Sub
Private Sub Valider_Click()
Dim i As Integer
'feuille contenant la valeur à chercher
With Sheets("CONTRATS")
'de la ligne 2 à la dernière ligne utilisée de la colonne J
For i = 2 To .Cells(Rows.Count, 10).End(xlUp).Row
'recherche de la ligne en colonne j qui correspond à la sélection du combobox
If .Cells(i, 10).Text = Me.ComboBox3 Then
'si oui texbox1 = colonne suivante même ligne
tbxproduit = .Cells(i, 6).Text
tbxlieu = .Cells(i, 12).Text
tbxprix = .Cells(i, 14).Text
tbxdestinataire = .Cells(i, 8).Text
tbxClientsFact = .Cells(i, 9).Text
tbxClientsLivr = .Cells(i, 7).Text
Exit For
End If
Next
End With
End Sub
Private Sub UserForm_Initialize()
With tbxspecifications
'spécifie que la touche ENTREE ajoutera une nouvelle ligne
tbxspecifications.EnterKeyBehavior = True
End With
End Sub
Private Sub UserForm_Activate()
With Me
.StartUpPosition = 3
.Width = Application.Width
.Height = Application.Height
.Left = 0
.Top = 0
End With
End Sub |
Partager