Ma UserForm déjà
Private Sub BtAjouter_Click()
Dim derligne As Integer
If MsgBox("Confirmez-vous l'ajout de nouvelles données?", vbYesNo, "comfimation") = vbYes Then
derligne = Sheets("Gestion").Range("A65536").End(xlUp).Row + 1
Cells(derligne, 1) = ComboBox1.Value
Cells(derligne, 2) = ComboBox2.Value
Cells(derligne, 3) = ComboBox3.Value
Cells(derligne, 4) = ComboBox4.Value
Cells(derligne, 5) = ComboBox5.Value
Cells(derligne, 6) = ComboBox6.Value
Cells(derligne, 7) = ComboBox7.Value
Cells(derligne, 8) = ComboBox8.Value
Cells(derligne, 9) = TextBox1.Value
Cells(derligne, 10) = ComboBox9.Value
Cells(derligne, 11) = ComboBox10.Value
Cells(derligne, 12) = ComboBox11.Value
Cells(derligne, 13) = ComboBox12.Value
Cells(derligne, 14) = TextBox2.Value
Cells(derligne, 15) = TextBox3.Value
Cells(derligne, 16) = TextBox4.Value
End If
' ---------------------------------------------------------
Worksheets("GESTION").Range("A
").Columns.AutoFit
Range("A6").CurrentRegion.Activate
Selection.Font.Bold = True
With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
' -------------------------------------------------------
Unload Me_saisie
Me_saisie.Show
End Sub
Private Sub BtAller_Click()
Dim no_ligne As Integer
no_ligne = ComboBox13.ListIndex + 6
ComboBox1.Value = Cells(no_ligne, 1).Value
ComboBox2.Value = Cells(no_ligne, 2).Value
ComboBox3.Value = Cells(no_ligne, 3).Value
ComboBox4.Value = Cells(no_ligne, 4).Value
ComboBox5.Value = Cells(no_ligne, 5).Value
ComboBox6.Value = Cells(no_ligne, 6).Value
ComboBox7.Value = Cells(no_ligne, 7).Value
ComboBox8.Value = Cells(no_ligne, 8).Value
TextBox1.Value = Cells(no_ligne, 9).Value
ComboBox9.Value = Cells(no_ligne, 10).Value
ComboBox10.Value = Cells(no_ligne, 11).Value
ComboBox11.Value = Cells(no_ligne, 12).Value
ComboBox12.Value = Cells(no_ligne, 13).Value
TextBox2.Value = Cells(no_ligne, 14).Value
TextBox3.Value = Cells(no_ligne, 15).Value
TextBox4.Value = Cells(no_ligne, 16).Value
End Sub
Private Sub BtModifier_Click()
Dim no_ligne As Integer
Sheets("GESTION").Select
no_ligne = ComboBox13.ListIndex + 6
If ComboBox1.Value = "" Then
MsgBox (" veuillez remplir le champs de la recherche!")
Else
Cells(no_ligne, 1) = ComboBox1.Value
Cells(no_ligne, 2) = ComboBox2.Value
Cells(no_ligne, 3) = ComboBox3.Value
Cells(no_ligne, 4) = ComboBox4.Value
Cells(no_ligne, 5) = ComboBox5.Value
Cells(no_ligne, 6) = ComboBox6.Value
Cells(no_ligne, 7) = ComboBox7.Value
Cells(no_ligne, 8) = ComboBox8.Value
Cells(no_ligne, 9) = TextBox1.Value
Cells(no_ligne, 10) = ComboBox9.Value
Cells(no_ligne, 11) = ComboBox10.Value
Cells(no_ligne, 12) = ComboBox11.Value
Cells(no_ligne, 13) = ComboBox12.Value
Cells(no_ligne, 14) = TextBox2.Value
Cells(no_ligne, 15) = TextBox3.Value
Cells(no_ligne, 16) = TextBox4.Value
MsgBox ("Modification effectuée")
Unload Me_saisie
Me_saisie.Show
End If
Exit Sub
End Sub
Private Sub BtQuitter_Click()
Unload Me_saisie
End Sub
Private Sub Btsup_Click()
If MsgBox("Confirmez-vous la suppression?", vbYesNo, "Demande de confirmation de suppression") = vbYes Then
Rows([A6:A65536].Find(ComboBox1.Value).Row).EntireRow.Delete
Unload Me_saisie
Me_saisie.Show
End If
End Sub