XL 2010 bouton moedifier sur userform

axc

XLDnaute Nouveau
Bonsoir,

J'ai mis au point plusieurs formulaires de saisies. Pour les boutons enregistrer, quitter, effacer , j'utilise des contrôleslabels. Dans mes recherches sur les codes pour un bouton modifier j'ai trouvé deux codes. un membre du forum pourrait-il m'expliquer ce que veut dire le code afin qu'après l'avoir compris je puisse l'adapter .

Merci
Code 1

Private Sub CommandButton2_Click()



Dim Ctrl As Control

Dim Colonne As Integer

Dim Ligne As Long



If Me.ComboBox1.ListIndex = -1 Then Exit Sub

Ligne = Me.ComboBox1.ListIndex + 2

With Sheets("Sheet1")



.Range("A" & Ligne).Value = ComboBox1

.Range("C" & Ligne).Value = ComboBox2

.Range("D" & Ligne).Value = ComboBox3

.Range("E" & Ligne).Value = ComboBox4

.Range("F" & Ligne).Value = ComboBox5

.Range("G" & Ligne).Value = ComboBox6

.Range("B" & Ligne).Value = TextBox1.Value

.Range("H" & Ligne).Value = TextBox2.Value

.Range("I" & Ligne).Value = TextBox3.Value

.Range("J" & Ligne).Value = TextBox4.Value

.Range("K" & Ligne).Value = TextBox5.Value

.Range("L" & Ligne).Value = TextBox6.Value



End With

End Sub









Code 2

'MODIFIER

Private Sub CommandButton3_Click()



Dim no_ligne As Integer

Sheets("Feuil1").Select

no_ligne = ComboBox3.ListIndex + 2

If ComboBox1.Value = "" Then

MsgBox ("Veuillez remplir tous les champs")

Else

Cells(no_ligne, 1) = ComboBox1.Value

Cells(no_ligne, 2) = ComboBox2.Value

End If

End Sub






D'avance merci
 

Statistiques des forums

Discussions
312 103
Messages
2 085 319
Membres
102 862
dernier inscrit
Emma35400