Sub LaMacroQuiEstLongue()
' Traduite de la macro exemple de Jonhn Walkenbach
' Insère des nombres aléatoires sur la feuille active
[COLOR=black]Dim Counter As Integer[/COLOR]
[COLOR=black] Dim RowMax As Integer, ColMax As Integer[/COLOR]
[COLOR=black] Dim r As Integer, c As Integer[/COLOR]
[COLOR=black] Dim PourcentageEffectue As Single[/COLOR]
[COLOR=blue] If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub[/COLOR]
[COLOR=blue] Cells.Clear[/COLOR]
[COLOR=blue] Counter = 1[/COLOR]
[COLOR=blue] RowMax = 200[/COLOR]
[COLOR=blue] ColMax = 25[/COLOR]
[COLOR=blue] For r = 1 To RowMax[/COLOR]
[COLOR=blue] For c = 1 To ColMax[/COLOR]
[COLOR=blue] Cells(r, c) = Int(Rnd * 1000)[/COLOR]
[COLOR=blue] Counter = Counter + 1[/COLOR]
[COLOR=blue] Next c[/COLOR]
PourcentageEffectue = Counter / (RowMax * ColMax)
PourcentageEffectue = Format(Left(Format(PourcentageEffectue, "0.000"), 4), "#0.00")
Call UpdateProgress(PourcentageEffectue)
Next r
Unload FrmProgression
End Sub
Sub UpdateProgress(PourcentageEffectue)
With FrmProgression
.FrameProgress.Caption = Format(PourcentageEffectue, "0%")
.LabelProgress.Width = PourcentageEffectue * (.FrameProgress.Width - 10)
.Repaint
End With
End Sub