modification dans une textbox qui affiche déja une cellule de la base de donnée excel

bouchet2

XLDnaute Nouveau
J'ai un tableau excel pour les clients et honoraires dus et a recevoir avec 36 colonnes et 50 lignes.
J'ai crée un userform2 de consultation qui marche très bien (en dehors problèmes de deux chiffres après la virgule ) j'ai aussi crée un userform 1 création clients qui va bien.
Je voudrais sur userform2 qui sert de visualisation pourvoir remplir des cases encore vide.
J'ai repris les codes de userform 1 de création , mais çà ne marche pas.
Merci d'avance de votre aide.


Private Sub CLIENTS_Click()

End Sub

'tentative de deux chiffres après la virgule

'essai pour 2 chiffres aprés la virgule
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1 = "" Then Exit Sub
If Not IsNumeric(TextBox1) Then
TextBox1 = ""
TextBox1.SetFocus
End If
Exit Sub
TextBox1 = Format(TextBox1, "# ##0.00")
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox2 = "" Then Exit Sub
If Not IsNumeric(TextBox2) Then
TextBox2 = ""
TextBox2.SetFocus
End If
Exit Sub
TextBox2 = Format(TextBox2, "# ##0.00")
End Sub
Private Sub TextBox13_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox13 = "" Then Exit Sub
If Not IsNumeric(TextBox13) Then
TextBox13 = ""
TextBox13.SetFocus
End If
Exit Sub
TextBox13 = Format(TextBox13, "# ##0.00")
End Sub

Private Sub TextBox18_Change()

End Sub

Private Sub TextBox19_Change()

End Sub

Private Sub TextBox20_Change()

End Sub

Private Sub TextBox23_Change()

End Sub

Private Sub TextBox24_Change()

End Sub

Private Sub TextBox27_Change()

End Sub

Private Sub TextBox28_Change()

End Sub

Private Sub TextBox31_Change()
TextBox31.Value = Format(TextBox31.Value, "### ### ##0.00")
End Sub

Private Sub TextBox32_Change()
TextBox32.Value = Format(TextBox32.Value, "### ### ##0.00")
End Sub

Private Sub TextBox35_Change()
TextBox35.Value = Format(TextBox35.Value, "### ### ##0.00")
End Sub

Private Sub TextBox5_Change()
TextBox5.Value = Format(TextBox5.Value, "### ### ##0.00")
End Sub

Private Sub TextBox7_Change()
TextBox7.Value = Format(TextBox7.Value, "### ### ##0.00")
End Sub

Private Sub TextBox8_Change()
TextBox8.Value = Format(TextBox8.Value, "### ### ##0.00")
End Sub

Private Sub TextBox9_Change()
TextBox9.Value = Format(TextBox9.Value, "### ### ##0.00")
End Sub

Ce code ci dessous marche bien

Private Sub UserForm_Initialize()
Set f = Sheets("BD")
For Each c In f.Range("A6:A" & f.[A65000].End(xlUp).Row)
Me.ComboBox1.AddItem c
Next c
End Sub
Private Sub ComboBox1_Click()
Set f = Sheets("BD")
ligne = Me.ComboBox1.ListIndex + 6
Me.TextBox1 = f.Cells(ligne, 3)
Me.TextBox2 = f.Cells(ligne, 4)
Me.TextBox3 = f.Cells(ligne, 5)
Me.TextBox4 = f.Cells(ligne, 6)
Me.TextBox5 = f.Cells(ligne, 7)
Me.TextBox6 = f.Cells(ligne, 8)
Me.TextBox7 = f.Cells(ligne, 9)
Me.TextBox8 = f.Cells(ligne, 11)
Me.TextBox9 = f.Cells(ligne, 12)
Me.TextBox10 = f.Cells(ligne, 13)
Me.TextBox11 = f.Cells(ligne, 14)
Me.TextBox12 = f.Cells(ligne, 15)
Me.TextBox13 = f.Cells(ligne, 16)
Me.TextBox14 = f.Cells(ligne, 17)
Me.TextBox15 = f.Cells(ligne, 18)
Me.TextBox16 = f.Cells(ligne, 19)
Me.TextBox17 = f.Cells(ligne, 20)
Me.TextBox18 = f.Cells(ligne, 21)
Me.TextBox19 = f.Cells(ligne, 22)
Me.TextBox20 = f.Cells(ligne, 23)
Me.TextBox21 = f.Cells(ligne, 24)
Me.TextBox22 = f.Cells(ligne, 25)
Me.TextBox23 = f.Cells(ligne, 26)
Me.TextBox24 = f.Cells(ligne, 27)
Me.TextBox25 = f.Cells(ligne, 28)
Me.TextBox26 = f.Cells(ligne, 29)
Me.TextBox27 = f.Cells(ligne, 30)
Me.TextBox28 = f.Cells(ligne, 31)
Me.TextBox29 = f.Cells(ligne, 32)
Me.TextBox30 = f.Cells(ligne, 33)
Me.TextBox31 = f.Cells(ligne, 34)
Me.TextBox32 = f.Cells(ligne, 35)
Me.TextBox33 = f.Cells(ligne, 36)
Me.TextBox34 = f.Cells(ligne, 37)

End Sub

a partir de la ça ne marche pas pour remplir les textbox
'essai pour remplir les cellules a partir de userform2

Private Sub validation_Click()
Set f = Sheets("BD")
ligne = Me.ComboBox1.ListIndex + 6
'--- Contrôles
If Me.texbox1 = "" Then
MsgBox "texbox1!"
Me.texbox1.SetFocus
Exit Sub
End If
If Me.texbox14 = "" Then
MsgBox "texbox14!"
Me.TextBox14.SetFocus
Exit Sub
End If
If Me.texbox12 = "" Then
MsgBox "texbox12!"
Me.TextBox12.SetFocus
Exit Sub
End If
If Me.texbox16 = "" Then
MsgBox "texbox16!"
Me.TextBox16.SetFocus
Exit Sub
End If
If Me.texbox26 = "" Then
MsgBox "texbox26!"
Me.TextBox26.SetFocus
Exit Sub
End If
'--- Positionnement dans la base
ligne = Sheets("BD").[A65000].End(xlUp).Row + 1
'--- Transfert Formulaire dans BD
Sheets("BD").Cells(ligne, 3) = Me.TextBox1
Sheets("BD").Cells(ligne, 11) = Me.texbox14
Sheets("BD").Cells(ligne, 15) = Me.texbox12
Sheets("BD").Cells(ligne, 19) = Me.texbox16
Sheets("BD").Cells(ligne, 23) = Me.texbox26

End Sub
Private Sub B_fin_Click()
Unload Me ' Formulaire actif
End Sub
 

Pièces jointes

  • TABLEAU DE BORD-TRAVAIL.xlsm
    142.9 KB · Affichages: 83

Discussions similaires

  • Question
Microsoft 365 TEXTBOX
Réponses
7
Affichages
325
Réponses
6
Affichages
223

Membres actuellement en ligne

Statistiques des forums

Discussions
312 023
Messages
2 084 715
Membres
102 637
dernier inscrit
TOTO33000