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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Sub creer_ts_v1()
' Fonction ADD dans boucle FOR pour ajouter 579 lignes
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' désactiver les MAJ cf affichage & recalcul pour gagner du temps à l'exécution
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
Application.Calculation = xlCalculationManual
' récupérer l'heure courante au début (pour messure du temps d'exécution)
tempsDebut = Timer
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' nom du ts à manipuler
LDD = "ts_v1"
' RAZ TS
If Not Range(LDD).ListObject.DataBodyRange Is Nothing Then
Range(LDD).ListObject.DataBodyRange.Delete
End If
' boucle FOR
For cpt = 1 To 579
' ajouter 1 ligne dans le TS
Range(LDD).ListObject.ListRows.Add
ligne = Range(LDD).ListObject.ListRows.Count
' compléter la ligne 1 avec le n° du cpt
Range(LDD).ListObject.DataBodyRange(ligne, 1) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 2) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 3) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 4) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 5) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 6) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 7) = cpt
Range(LDD).ListObject.DataBodyRange(ligne, 8) = cpt
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' récupérer l'heure courante à la fin (pour messure du temps d'exécution)
tempsFin = Timer
' réactiver les MAJ cf affichage & recalcul à la fin
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.EnableEvents = True
ActiveSheet.DisplayPageBreaks = True
Application.Calculation = xlCalculationAutomatic
' affichage de fin pour prévenir l'utilisateur (avec ou sans mesure du temps d'exécution)
MsgBox "FIN - " & tempsFin - tempsDebut & "s"
'MsgBox "FIN"
End Sub |
Partager