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
| Sub LaMacroQuiEstLongue()
Top20.Show
'If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Application.ScreenUpdating = False
Top20.Repaint
Sheets("Feuil1").Select
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PourcentageEffectue As Single
Cells.Clear
Counter = 1
RowMax = 200
ColMax = 25
For r = 1 To RowMax
For c = 1 To ColMax
Cells(r, c) = Int(Rnd * 1000)
Counter = Counter + 1
Next c
Sleep (1000)
PourcentageEffectue = Counter / (RowMax * ColMax)
Call UpdateProgress(PourcentageEffectue)
Next r
End Sub
Sub UpdateProgress(PourcentageEffectue)
With Top20
.FrameProgress.Caption = Format(PourcentageEffectue, "0%")
.LabelProgress.Width = PourcentageEffectue * (.FrameProgress.Width - 10)
.FrameProgress.Repaint
End With
End Sub |