progressbar conseil

rainbow69006

XLDnaute Occasionnel
Bonjour Je souhaiterais cree une progressbar pendant le lancement d'un de mes sous programes.

J'ai trouve sa sur internet , mais je n'y comprend rien. Quelqu'un peut il m conseiller?

Private Sub UserForm_activate()
Call Main
End Sub
-----------------------------------------------------
Sub Main()
' Inserts random numbers on the active worksheet
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single

If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Cells.Clear
Application.ScreenUpdating = False
Counter = 1
RowMax = 100
ColMax = 25
For r = 1 To RowMax
For c = 1 To ColMax
Cells(r, c) = Int(Rnd * 1000)
Counter = Counter + 1
Next c
PctDone = Counter / (RowMax * ColMax)
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
' The DoEvents statement is responsible for the form updating
DoEvents
Next r
Unload UserForm1
End Sub
Creating the start-up subroutine
All that's missing is a subroutine to display the dialog box. Enter the following subroutine in a VBA module.
-----------------------------------------------------------
Sub ShowDialog()
UserForm1.LabelProgress.Width = 0
UserForm1.Show
End Sub
 

rainbow69006

XLDnaute Occasionnel
Re : progressbar conseil

mmm interessant.

J'ai cependant deux questions:
- pourquoi sa cree plein de chiffres?
- J'ai un programe lourd qui met au moin 45sec a 1 min pour afficher le informations. je peu mettre une toolbar comme celle ci pour m'afficher le temps qu'il reste pour l'execution de mon programe? Si oui ou dois je mettre ton code d'userbar?

merci de ton soutien
 

Discussions similaires

Réponses
0
Affichages
285

Membres actuellement en ligne

Statistiques des forums

Discussions
312 677
Messages
2 090 824
Membres
104 677
dernier inscrit
soufiane12