code qui ralentit mon système

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

davidp

XLDnaute Occasionnel
Bonjour le forum ,

désolé de vous ennuyer à mon problème et merci d'avance.

Le code ci dessous a tendance à ralentir mon programme.

-il y a t il une possibilité de rendre plus light?

Private Sub CommandButton1_Click()

With Sheets("boulangerie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("poisson")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("fruit")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("charcuterie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("fromage")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("boucherie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("epicerie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("surgele")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("industrielle")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("rotisserie")
.Range("G6:G76").Value = TextBox1.Value
Unload Me
Nom.Show
End With
End With
End With
End With
End With
End With
End With
End With
End With
End With
End Sub


Merci d'avance et bonne journée
 
Re : code qui ralentit mon système

Merci Pascal XLD,

je n'ai pas réussi à faire fonctionner le code ci dessous.

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
With Sheets("boulangerie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("poisson")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("fruit")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("charcuterie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("fromage")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("boucherie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("epicerie")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("surgele")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("industrielle")
.Range("G6:G76").Value = TextBox1.Value
With Sheets("rotisserie")
.Range("G6:G76").Value = TextBox1.Value
Unload Me
Nom.Show
Application.ScreenUpdating = True
End Sub

Je t'avoue que je suis perdu

Merci d'avance pour ton aide
 
Re : code qui ralentit mon système

bonjour David,Pascal

une autre proposition

Private Sub CommandButton1_Click()
Dim Tbl As Variant
Dim I As Byte

Tbl = Array("boucherie", "boulangerie", "charcuterie", "epicerie", "fromage", _
"industrielle", "poisson", "rotisserie", "surgele")

Application.ScreenUpdating = False

For I = 1 To UBound(Tbl)
With Sheets(Tbl(I))
.Range("G6:G76").Value = TextBox1.Value
End With
Next I

Application.ScreenUpdating = True

Unload Me
Nom.Show

End Sub

à bientôt
 
Re : code qui ralentit mon système

j'en profite pour poser une question à Pascal
je m'initie au module de classe textbox
j'ai essayer les évènements,click,change,DblClick,etc,tous ok sauf exit pas de réaction
l'évènement n'est pas géré ou quoi

'le code module de classe ClassTextbox
'Garder le focus dans un TextBox tant qu'il est vide

Public WithEvents GroupeTextBox As MSForms.TextBox

Private Sub GroupeTextBox_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim I As Byte

I = InStr(GroupeTextBox.Name, "TextBox")

If UserForm2.Controls("TextBox" & I).Value = "" Then Cancel = True

End Sub

à bientôt
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

M
Réponses
3
Affichages
2 K
MONADESIGN82
M
S
Réponses
13
Affichages
2 K
Stedemart
S
K
Réponses
8
Affichages
2 K
kuistau
K
D
Réponses
3
Affichages
739
David44800
D
M
  • Question Question
Réponses
5
Affichages
1 K
S
Réponses
4
Affichages
1 K
sp3ktroom
S
P
Réponses
16
Affichages
2 K
Pineurne
P
Retour