Private Sub CommandButton8_Click()
Application.ScreenUpdating = False
RienL = 100000 'erreur si > 65536!
ReDim TabEssai(1 To RienL, 1)
colonne = 1 '===>> ici le numéro de la colonne où écrire tes valeurs
For rienl1 = 1 To RienL
TabEssai(rienl1, 1) = rienl1 & "a" ' pour l'exemple
Next
With Worksheets("Essai")
.Columns(colonne).ClearContents
.Columns(colonne).Insert Shift:=xlShiftleft
.Range(.Cells(1, colonne), .Cells(UBound(TabEssai), colonne + 1)).Value = TabEssai
.Columns(colonne).Delete
End With
Application.ScreenUpdating = True
End Sub
Sub TransposeBis() Dim arr(), N As Long [D:D].ClearContents Application.Calculation = xlCalculationManual N = Application.InputBox("How many trials?", Type:=1) ReDim arr(1 To N, 1 To 1) For i = 1 To N arr(i, 1) = Int(Rnd * 10) + 1 Next i Application.ScreenUpdating = False Range("E1") = N With Range("D2") .Resize(N, 1).Value = arr 'Application.Transpose(arr) End With Application.Calculation = xlCalculationAutomatic End Sub
Option Base 1 Sub essaiAffiche() Dim TabEssai() Application.ScreenUpdating = True Worksheets(2).Activate RienL = 65536 'erreur si > 65536! ReDim TabEssai(RienL) For RienL1 = 1 To RienL TabEssai(RienL1) = "azertyuio" ' pour l'exemple Next [D:D].ClearContents [D1].Resize(RienL) = Application.Transpose(TabEssai) End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub LeTien()
Application.ScreenUpdating = False
rienl = 100000 'erreur si > 65536!
ReDim TabEssai(1 To rienl, 1)
colonne = 1 '===>> ici le numéro de la colonne où écrire tes valeurs
For rienl1 = 1 To rienl
TabEssai(rienl1, 1) = rienl1 & "a" ' pour l'exemple
Next
maintenant = Now
For rienN = 1 To 10
With Worksheets("Essai")
.Columns(colonne).ClearContents
.Columns(colonne).Insert Shift:=xlShiftleft
.Range(.Cells(1, colonne), .Cells(UBound(TabEssai), colonne + 1)).Value = TabEssai
.Columns(colonne).Delete
.Range("B1") = "Toi"
.Range("B2") = Now - maintenant
.Range("C1") = rienl
End With
Next rienN
Application.ScreenUpdating = True
End Sub
Sub LeMien()
Dim TabEssai()
Dim N As Long
[D:D].ClearContents
Application.Calculation = xlCalculationManual
'N = Application.InputBox("How many trials?", Type:=1)
N = 100000
ReDim TabEssai(1 To N, 1 To 1)
For rienl1 = 1 To N
TabEssai(rienl1, 1) = rienl1 & "a" ' pour l'exemple
Next
Application.ScreenUpdating = False
maintenant = Now
For rienN = 1 To 10
With Worksheets("Essai")
.Range("D2").Resize(N, 1).Value = TabEssai 'Application.Transpose(TabEssai)
.Range("E1") = "Moi"
.Range("E2") = Now - maintenant
.Range("F1") = N
End With
Next rienN
Application.Calculation = xlCalculationAutomatic
End Sub
Dim debut As Double
debut = Timer
For i = 0 To 1000000
toto = toto + 2
Next
MsgBox "cette boucle a duré " & Timer - debut & " secondes"
Marquer comme résolu