Bonjour,
Petites recommandations : utilise les balises code # :
c'est plus lisible pour le code ... y a des couleurs ..
Erreur de débutant 
Sinon, quand le code en long ... ou que tu as des userform ...
il y a la possibilité de mettre le fichier en piece jointe 
Pour ton problème :
1 2
| Rows("2:2").Select
Selection.Insert shift: x1Dow , CopyOrigin: x1FormatFronleftOrabove |
peut etre remplacer par :
tu met
1 2 3
| Private Sub TextBox1_Change()
Range("A2").Value = TextBox1.Value
End Sub |
a chaque caractere taper dans le textbox, il va modifier la cellule A2
=> ca risque de ramer ...
Je ne sais pas si cela peut t'aider :
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
|
Private Sub CommandButton5_Click()
alim_textbox ("horaires")
End Sub
Private Sub CommandButton6_Click()
alim_textbox ("recettes")
End Sub
Private Sub CommandButton7_Click()
alim_textbox ("fournisseurs")
End Sub
Private Sub CommandButton8_Click()
alim_textbox ("banque")
End Sub
Private Sub alim_textbox( sh As string)
With Worksheets(sh)
'Insertion d'une ligne
.Rows("2:2").Insert
.Range("A2").Value = TextBox1.Value
.Range("F2").Value = TextBox10.Value
.Range("B2").Value = TextBox12.Value
.Range("C2").Value = TextBox13.Value
.Range("d2").Value = TextBox14.Value
.Range("e2").Value = TextBox15.Value
'...
End With
'Vide les textbox
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
'...
'sauvegarde le fichier
ActiveWorkbook.Save
End Sub |
Partager