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
| Option Explicit
Dim Ws As Worksheet
Private Sub UserForm_Initialize()
Dim J As Long
Dim h As Integer
End Sub
Private Sub CommandButton1_Click()
Dim L As Integer
If MsgBox("Confirmez-vous l'insertion de ce nouveau contact ?", vbYesNo, "Demande de confirmation d'ajout") = vbYes Then
L = Sheets("Commerce").Range("a65536").End(xlUp).Row + 1
Range("a" & L).Value = TextBox1
Range("b" & L).Value = TextBox2
Range("c" & L).Value = TextBox3
Range("d" & L).Value = TextBox4
Range("e" & L).Value = TextBox5
Range("f" & L).Value = TextBox8
Range("g" & L).Value = TextBox6
Range("h" & L).Value = TextBox7
Range("i" & L).Value = TextBox9
Range("j" & L).Value = TextBox10
Range("k" & L).Value = TextBox11
Range("l" & L).Value = TextBox12
Range("m" & L).Value = TextBox13
Range("n" & L).Value = TextBox14
Range("o" & L).Value = TextBox15
Range("p" & L).Value = TextBox16
Range("q" & L).Value = TextBox17
Range("r" & L).Value = TextBox18
Range("s" & L).Value = TextBox19
Range("t" & L).Value = TextBox20
Range("u" & L).Value = TextBox21
Range("v" & L).Value = TextBox22
Range("w" & L).Value = TextBox23
Range("x" & L).Value = TextBox24
Range("y" & L).Value = TextBox25
Range("z" & L).Value = TextBox26
Range("aa" & L).Value = TextBox27
Range("ab" & L).Value = TextBox28
Range("ac" & L).Value = TextBox29
Range("ad" & L).Value = TextBox30
End If
End Sub
Private Sub CommandButton4_change()
If MsgBox("Etes-vous certain de vouloir modifier ce produit ?", vbYesNo, "Demande de confirmation") = vbYes Then
Dim Ligne As Long
Dim I As Integer
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox1.ListIndex + 2
For I = 1 To 30
If Me.Controls("TextBox" & I).Visible = True Then
Ws.Cells(Ligne, I + 1) = Me.Controls("TextBox" & I)
End If
Next I
End If
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub ComboBox1_Change()
Dim Lign As Long
If ComboBox1 = "" Then Exit Sub
With Sheets("commerce")
Lign = .Columns(1).Cells.Find(ComboBox1).Row
TextBox1.Text = Cells(Lign, 1).Value
TextBox2.Text = Cells(Lign, 2).Value
TextBox3.Text = Cells(Lign, 3).Value
TextBox4.Text = Cells(Lign, 4).Value
TextBox5.Text = Cells(Lign, 5).Value
TextBox6.Text = Cells(Lign, 8).Value
TextBox7.Text = Cells(Lign, 6).Value
TextBox8.Text = Cells(Lign, 7).Value
TextBox9.Text = Cells(Lign, 9).Value
TextBox10.Text = Cells(Lign, 10).Value
TextBox11.Text = Cells(Lign, 11).Value
TextBox12.Text = Cells(Lign, 12).Value
TextBox13.Text = Cells(Lign, 13).Value
TextBox14.Text = Cells(Lign, 14).Value
TextBox15.Text = Cells(Lign, 15).Value
TextBox16.Text = Cells(Lign, 16).Value
TextBox17.Text = Cells(Lign, 17).Value
TextBox18.Text = Cells(Lign, 18).Value
TextBox19.Text = Cells(Lign, 19).Value
TextBox20.Text = Cells(Lign, 20).Value
TextBox21.Text = Cells(Lign, 21).Value
TextBox22.Text = Cells(Lign, 22).Value
TextBox23.Text = Cells(Lign, 23).Value
TextBox24.Text = Cells(Lign, 24).Value
TextBox25.Text = Cells(Lign, 25).Value
TextBox26.Text = Cells(Lign, 26).Value
TextBox27.Text = Cells(Lign, 27).Value
TextBox28.Text = Cells(Lign, 28).Value
TextBox29.Text = Cells(Lign, 29).Value
TextBox30.Text = Cells(Lign, 30).Value
End With
End Sub |
Partager