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 102 103 104 105 106 107 108 109 110 111
| Private Sub MultiPage1_Change()
End Sub
Private Sub UserForm_Initialize()
Dim J As Long
Dim I As Integer
ComboBox2.ColumnCount = 1
ComboBox2.List() = Array("", "Rue", "Av", "Bd", "Allée", "Place", "Ch", "Imp", "Square", "Quai", "RP")
Set Ws = Sheets("Redevance")
With Me.ComboBox1
For J = 2 To Ws.Range("A" & Rows.Count).End(xlUp).Row
.AddItem Ws.Range("A" & J)
Next J
End With
For I = 1 To 41
Me.Controls("TextBox" & I).Visible = True
Next I
End Sub
Private Sub ComboBox1_Change()
Dim Ligne As Long
Dim I As Integer
If ComboBox1 = "" Then Exit Sub
With Sheets("Redevance")
Ligne = Me.ComboBox1.ListIndex + 2
ComboBox2 = Ws.Cells(Ligne, "B")
For I = 1 To 41
Me.Controls("TextBox" & I) = .Cells(Ligne, I + 2).Value
Next I
End With
End Sub
Private Sub CommandButton1_Click()
Dim L As Integer
If MsgBox("Confirmez-vous linsertion de ce nouveau contact ?", vbYesNo, "Demande de confirmation dajout") = vbYes Then
L = Sheets("Redevance").Range("a65536").End(xlUp).Row + 1
Range("A" & L).Value = ComboBox1
Range("B" & L).Value = ComboBox2
Range("C" & L).Value = TextBox1
Range("D" & L).Value = TextBox2
Range("E" & L).Value = TextBox3
Range("F" & L).Value = TextBox4
Range("G" & L).Value = TextBox5
Range("H" & L).Value = TextBox6
Range("I" & L).Value = TextBox7
Range("J" & L).Value = TextBox8
Range("K" & L).Value = TextBox9
Range("L" & L).Value = TextBox10
Range("M" & L).Value = TextBox11
Range("P" & L).Value = TextBox12
Range("s" & L).Value = TextBox13
Range("T" & L).Value = TextBox14
Range("U" & L).Value = TextBox15
Range("V" & L).Value = TextBox16
Range("W" & L).Value = TextBox17
Range("X" & L).Value = TextBox18
Range("Y" & L).Value = TextBox19
Range("Z" & L).Value = TextBox20
Range("AA" & L).Value = TextBox21
Range("AB" & L).Value = TextBox22
Range("AC" & L).Value = TextBox23
Range("AD" & L).Value = TextBox24
Range("AE" & L).Value = TextBox25
Range("AF" & L).Value = TextBox26
Range("AG" & L).Value = TextBox27
Range("AH" & L).Value = TextBox28
Range("AI" & L).Value = TextBox29
Range("AJ" & L).Value = TextBox30
Range("AK" & L).Value = TextBox31
Range("AL" & L).Value = TextBox32
Range("AM" & L).Value = TextBox33
Range("AN" & L).Value = TextBox34
Range("AO" & L).Value = TextBox35
Range("AP" & L).Value = TextBox36
Range("AQ" & L).Value = TextBox37
Range("AR" & L).Value = TextBox38
Range("AS" & L).Value = TextBox39
Range("AT" & L).Value = TextBox40
Range("BA" & L).Value = TextBox41
Range("N" & L).Value = CheckBox1
Range("O" & L).Value = CheckBox2
Range("Q" & L).Value = CheckBox3
Range("R" & L).Value = CheckBox4
Range("AU" & L).Value = CheckBox5
Range("AV" & L).Value = CheckBox6
Range("AW" & L).Value = CheckBox7
Range("AX" & L).Value = CheckBox8
Range("AY" & L).Value = CheckBox9
Range("AZ" & L).Value = CheckBox10
Range("BB" & L).Value = CheckBox11
Range("BC" & L).Value = CheckBox12
End If
End Sub
Private Sub CommandButton2_Click()
Dim Ligne As Long
Dim I As Integer
If MsgBox("Confirmez-vous la modification de ce contact ?", vbYesNo, "Demande de confirmation de modification") = vbYes Then
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Ligne = Me.ComboBox1.ListIndex + 2
Ws.Cells(Ligne, "B") = ComboBox2
For I = 1 To 41
If Me.Controls("TextBox" & I).Visible = True Then
Ws.Cells(Ligne, I + 2) = Me.Controls("TextBox" & I)
End If
Next I
End If
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub |
Partager