Vba boucle for next
asterrax
Messages postés
13
Statut
Membre
-
asterrax Messages postés 13 Statut Membre -
asterrax Messages postés 13 Statut Membre -
Bonjour,
J'ai un code simple qui a une vitesse d'exécution très lente. Comment l'améliorer? Le but est de copier coller une ligne sur deux sur une autre destination.
Sub diviseL()
Dim NbLigne As String, I As String
NbLigne = Cells(5, 3).End(xlDown).Row - 4
NbLigne = NbLigne / 2
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For I = 1 To NbLigne
Range(Cells(4 + I, 6), Cells(4 + I, 8)).Value = Range(Cells(4 + 2 * I, 2), Cells(4 + 2 * I, 4)).Value
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Next I
End Sub
Merci!
J'ai un code simple qui a une vitesse d'exécution très lente. Comment l'améliorer? Le but est de copier coller une ligne sur deux sur une autre destination.
Sub diviseL()
Dim NbLigne As String, I As String
NbLigne = Cells(5, 3).End(xlDown).Row - 4
NbLigne = NbLigne / 2
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For I = 1 To NbLigne
Range(Cells(4 + I, 6), Cells(4 + I, 8)).Value = Range(Cells(4 + 2 * I, 2), Cells(4 + 2 * I, 4)).Value
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Next I
End Sub
Merci!
A voir également:
- Vba boucle for next
- Downloader for pc - Télécharger - Téléchargement & Transfert
- Idm for mac - Télécharger - Téléchargement & Transfert
- Instagram for pc - Télécharger - Divers Communication
- Microsoft store download for pc - Guide
- Winrar for pc - Télécharger - Compression & Décompression
2 réponses
Salut le forum
Déplace les lignes
Après ton Next I
Mytå
Déplace les lignes
Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True
Après ton Next I
Mytå
merci! vraiment bête mon erreur....la fatigue surement....
j'ai lancé mon application avec ça finalement
Sub ligne()
Dim A, B
A = 0
B = 0
Application.Calculation = xlCalculationManual
While Cells(A + 5, 2) <> ""
Cells(B + 5, 6) = Cells(A + 5, 2)
Cells(B + 5, 7) = Cells(A + 5, 3)
Cells(B + 5, 8) = Cells(A + 5, 4)
A = A + 2
B = B + 1
Wend
Application.Calculation = xlCalculationAutomatic
End Sub
quelle méthode est la plus rapide ou efficace dans un code plus complet? for next ou while wend ou autre?
j'ai lancé mon application avec ça finalement
Sub ligne()
Dim A, B
A = 0
B = 0
Application.Calculation = xlCalculationManual
While Cells(A + 5, 2) <> ""
Cells(B + 5, 6) = Cells(A + 5, 2)
Cells(B + 5, 7) = Cells(A + 5, 3)
Cells(B + 5, 8) = Cells(A + 5, 4)
A = A + 2
B = B + 1
Wend
Application.Calculation = xlCalculationAutomatic
End Sub
quelle méthode est la plus rapide ou efficace dans un code plus complet? for next ou while wend ou autre?