Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

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
 
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
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
XL 2021 VBA excel
Réponses
4
Affichages
180
  • Question Question
Microsoft 365 Erreur UBound
Réponses
4
Affichages
150
Réponses
3
Affichages
198
Réponses
10
Affichages
292
Réponses
5
Affichages
190
Retour